- using Perforce.P4;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using System;
- namespace p4api.net.unit.test
- {
- /// <summary>
- ///This is a test class for FileLineMatchTest and is intended
- ///to contain all FileLineMatchTest Unit Tests
- ///</summary>
- [TestClass()]
- public class FileLineMatchTest
- {
- private TestContext testContextInstance;
- /// <summary>
- ///Gets or sets the test context which provides
- ///information about and functionality for the current test run.
- ///</summary>
- public TestContext TestContext
- {
- get
- {
- return testContextInstance;
- }
- set
- {
- testContextInstance = value;
- }
- }
- #region Additional test attributes
- //
- //You can use the following additional attributes as you write your tests:
- //
- //Use ClassInitialize to run code before running the first test in the class
- //[ClassInitialize()]
- //public static void MyClassInitialize(TestContext testContext)
- //{
- //}
- //
- //Use ClassCleanup to run code after all tests in a class have run
- //[ClassCleanup()]
- //public static void MyClassCleanup()
- //{
- //}
- //
- //Use TestInitialize to run code before running each test
- //[TestInitialize()]
- //public void MyTestInitialize()
- //{
- //}
- //
- //Use TestCleanup to run code after each test has run
- //[TestCleanup()]
- //public void MyTestCleanup()
- //{
- //}
- //
- #endregion
- /// <summary>
- ///A test for FileSpec
- ///</summary>
- [TestMethod()]
- [DeploymentItem("p4api.net.dll")]
- public void FileSpecTest()
- {
- FileLineMatch target = new FileLineMatch(MatchType.After, "the matching line", 4,
- new FileSpec(new DepotPath("//depot/..."), new Revision(2)));
- FileSpec expected = new FileSpec(new ClientPath("//annotate/..."),
- new VersionRange(new LabelNameVersion("my_label"), new LabelNameVersion("my_old_label")));
- FileSpec actual;
- target.FileSpec = expected;
- actual = target.FileSpec;
- Assert.AreEqual(expected, actual);
- }
- /// <summary>
- ///A test for Line
- ///</summary>
- [TestMethod()]
- [DeploymentItem("p4api.net.dll")]
- public void LineTest()
- {
- FileLineMatch target = new FileLineMatch(MatchType.After, "the matching line", 4,
- new FileSpec(new DepotPath("//depot/..."), new Revision(2)));
- string expected = "here is a line";
- string actual;
- target.Line = expected;
- actual = target.Line;
- Assert.AreEqual(expected, actual);
- }
- /// <summary>
- ///A test for LineNumber
- ///</summary>
- [TestMethod()]
- [DeploymentItem("p4api.net.dll")]
- public void LineNumberTest()
- {
- FileLineMatch target = new FileLineMatch(MatchType.After, "the matching line", 4,
- new FileSpec(new DepotPath("//depot/..."), new Revision(2)));
- int expected = 1999;
- int actual;
- target.LineNumber = expected;
- actual = target.LineNumber;
- Assert.AreEqual(expected, actual);
- }
- /// <summary>
- ///A test for Type
- ///</summary>
- [TestMethod()]
- [DeploymentItem("p4api.net.dll")]
- public void TypeTest()
- {
- FileLineMatch target = new FileLineMatch(MatchType.After, "the matching line", 4,
- new FileSpec(new DepotPath("//depot/..."), new Revision(2)));
- MatchType expected = MatchType.Before;
- MatchType actual;
- target.Type = expected;
- actual = target.Type;
- Assert.AreEqual(expected, actual);
- }
- }
- }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 13946 | OmegaNemesis28 | Merging //guest/perforce_software/p4api.net/... to //guest/omeganemesis28/p4api.net/...... « |
10 years ago | |
//guest/perforce_software/p4api.net/p4api.net-unit-test/FileLineMatchTest.cs | |||||
#2 | 8964 | Bill | fix line endings | 11 years ago | |
#1 | 8873 | Matt Attaway | Initial add of the P4API.NET source code | 11 years ago |