using Perforce.P4; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; namespace p4api.net.unit.test { /// ///This is a test class for FileHistoryTest and is intended ///to contain all FileHistoryTest Unit Tests /// [TestClass()] public class FileHistoryTest { private TestContext testContextInstance; /// ///Gets or sets the test context which provides ///information about and functionality for the current test run. /// 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 /// ///A test for Action /// [TestMethod()] public void ActionTest() { int revision = 0; // TODO: Initialize to an appropriate value int changelistid = 0; // TODO: Initialize to an appropriate value FileAction action = FileAction.Delete; DateTime date = new DateTime(); // TODO: Initialize to an appropriate value string username = string.Empty; // TODO: Initialize to an appropriate value FileType filetype = null; // TODO: Initialize to an appropriate value string description = string.Empty; // TODO: Initialize to an appropriate value string digest = string.Empty; int filesize = 0; PathSpec depotpath = null; // TODO: Initialize to an appropriate value string clientname = string.Empty; // TODO: Initialize to an appropriate value List integrationsummaries = null; // TODO: Initialize to an appropriate value FileHistory target = new FileHistory(revision, changelistid, action, date, username, filetype, description, digest, filesize, depotpath, clientname, integrationsummaries); // TODO: Initialize to an appropriate value FileAction expected = action; FileAction actual; target.Action = expected; actual = target.Action; Assert.AreEqual(expected, actual); } /// ///A test for ChangelistId /// [TestMethod()] public void ChangelistIdTest() { int revision = 0; // TODO: Initialize to an appropriate value int changelistid = 12345; FileAction action = new FileAction(); // TODO: Initialize to an appropriate value DateTime date = new DateTime(); // TODO: Initialize to an appropriate value string username = string.Empty; // TODO: Initialize to an appropriate value FileType filetype = null; // TODO: Initialize to an appropriate value string description = string.Empty; // TODO: Initialize to an appropriate value string digest = string.Empty; int filesize = 0; PathSpec depotpath = null; // TODO: Initialize to an appropriate value string clientname = string.Empty; // TODO: Initialize to an appropriate value List integrationsummaries = null; // TODO: Initialize to an appropriate value FileHistory target = new FileHistory(revision, changelistid, action, date, username, filetype, description, digest, filesize, depotpath, clientname, integrationsummaries); // TODO: Initialize to an appropriate value int expected = changelistid; int actual; target.ChangelistId = expected; actual = target.ChangelistId; Assert.AreEqual(expected, actual); } /// ///A test for ClientName /// [TestMethod()] public void ClientNameTest() { int revision = 0; // TODO: Initialize to an appropriate value int changelistid = 0; // TODO: Initialize to an appropriate value FileAction action = new FileAction(); // TODO: Initialize to an appropriate value DateTime date = new DateTime(); // TODO: Initialize to an appropriate value string username = string.Empty; // TODO: Initialize to an appropriate value FileType filetype = null; // TODO: Initialize to an appropriate value string description = string.Empty; // TODO: Initialize to an appropriate value string digest = string.Empty; int filesize = 0; PathSpec depotpath = null; // TODO: Initialize to an appropriate value string clientname = "clientname_filehistory"; List integrationsummaries = null; // TODO: Initialize to an appropriate value FileHistory target = new FileHistory(revision, changelistid, action, date, username, filetype, description, digest, filesize, depotpath, clientname, integrationsummaries); // TODO: Initialize to an appropriate value string expected = clientname; string actual; target.ClientName = expected; actual = target.ClientName; Assert.AreEqual(expected, actual); } /// ///A test for Date /// [TestMethod()] public void DateTest() { int revision = 0; // TODO: Initialize to an appropriate value int changelistid = 0; // TODO: Initialize to an appropriate value FileAction action = new FileAction(); // TODO: Initialize to an appropriate value DateTime date = new DateTime(2011,4,21); string username = string.Empty; // TODO: Initialize to an appropriate value FileType filetype = null; // TODO: Initialize to an appropriate value string description = string.Empty; // TODO: Initialize to an appropriate value string digest = string.Empty; int filesize = 0; PathSpec depotpath = null; // TODO: Initialize to an appropriate value string clientname = string.Empty; // TODO: Initialize to an appropriate value List integrationsummaries = null; // TODO: Initialize to an appropriate value FileHistory target = new FileHistory(revision, changelistid, action, date, username, filetype, description, digest, filesize, depotpath, clientname, integrationsummaries); // TODO: Initialize to an appropriate value DateTime expected = date; DateTime actual; target.Date = expected; actual = target.Date; Assert.AreEqual(expected, actual); } /// ///A test for DepotPath /// [TestMethod()] public void DepotPathTest() { int revision = 0; // TODO: Initialize to an appropriate value int changelistid = 0; // TODO: Initialize to an appropriate value FileAction action = new FileAction(); // TODO: Initialize to an appropriate value DateTime date = new DateTime(); // TODO: Initialize to an appropriate value string username = string.Empty; // TODO: Initialize to an appropriate value FileType filetype = null; // TODO: Initialize to an appropriate value string description = string.Empty; // TODO: Initialize to an appropriate value string digest = string.Empty; int filesize = 0; PathSpec depotpath = new DepotPath("//..."); string clientname = string.Empty; // TODO: Initialize to an appropriate value List integrationsummaries = null; // TODO: Initialize to an appropriate value FileHistory target = new FileHistory(revision, changelistid, action, date, username, filetype, description, digest, filesize, depotpath, clientname, integrationsummaries); // TODO: Initialize to an appropriate value PathSpec expected = depotpath; PathSpec actual; target.DepotPath = expected; actual = target.DepotPath; Assert.AreEqual(expected, actual); } /// ///A test for Description /// [TestMethod()] public void DescriptionTest() { int revision = 0; // TODO: Initialize to an appropriate value int changelistid = 0; // TODO: Initialize to an appropriate value FileAction action = new FileAction(); // TODO: Initialize to an appropriate value DateTime date = new DateTime(); // TODO: Initialize to an appropriate value string username = string.Empty; // TODO: Initialize to an appropriate value FileType filetype = null; // TODO: Initialize to an appropriate value string description = "this is the description"; string digest = string.Empty; int filesize = 0; PathSpec depotpath = null; // TODO: Initialize to an appropriate value string clientname = string.Empty; // TODO: Initialize to an appropriate value List integrationsummaries = null; // TODO: Initialize to an appropriate value FileHistory target = new FileHistory(revision, changelistid, action, date, username, filetype, description, digest, filesize, depotpath, clientname, integrationsummaries); // TODO: Initialize to an appropriate value string expected = description; string actual; target.Description = expected; actual = target.Description; Assert.AreEqual(expected, actual); } /// ///A test for FileType /// [TestMethod()] public void FileTypeTest() { int revision = 0; // TODO: Initialize to an appropriate value int changelistid = 0; // TODO: Initialize to an appropriate value FileAction action = new FileAction(); // TODO: Initialize to an appropriate value DateTime date = new DateTime(); // TODO: Initialize to an appropriate value string username = string.Empty; // TODO: Initialize to an appropriate value FileType filetype = null; // TODO: Initialize to an appropriate value string description = string.Empty; // TODO: Initialize to an appropriate value string digest = string.Empty; int filesize = 0; PathSpec depotpath = null; // TODO: Initialize to an appropriate value string clientname = string.Empty; // TODO: Initialize to an appropriate value List integrationsummaries = null; // TODO: Initialize to an appropriate value FileHistory target = new FileHistory(revision, changelistid, action, date, username, filetype, description, digest, filesize, depotpath, clientname, integrationsummaries); // TODO: Initialize to an appropriate value List ftm = new List(); FileType expected = new FileType(BaseFileType.Apple, FileTypeModifier.None, 16); FileType actual; target.FileType = expected; actual = target.FileType; Assert.AreEqual(expected, actual); } /// ///A test for IntegrationSummaries /// [TestMethod()] public void IntegrationSummariesTest() { int revision = 0; // TODO: Initialize to an appropriate value int changelistid = 0; // TODO: Initialize to an appropriate value FileAction action = new FileAction(); // TODO: Initialize to an appropriate value DateTime date = new DateTime(); // TODO: Initialize to an appropriate value string username = string.Empty; // TODO: Initialize to an appropriate value FileType filetype = null; // TODO: Initialize to an appropriate value string description = string.Empty; // TODO: Initialize to an appropriate value string digest = string.Empty; int filesize = 0; PathSpec depotpath = null; // TODO: Initialize to an appropriate value string clientname = string.Empty; // TODO: Initialize to an appropriate value List integrationsummaries = new List(); RevisionIntegrationSummary Summary1 = new RevisionIntegrationSummary ( new FileSpec(new LocalPath("c:\rev_int_sum"), new VersionRange(new LabelNameVersion("my_label"), new LabelNameVersion("my_old_label"))), "how"); FileHistory target = new FileHistory(revision, changelistid, action, date, username, filetype, description, digest, filesize, depotpath, clientname, integrationsummaries); // TODO: Initialize to an appropriate value target.IntegrationSummaries.Add(Summary1); Assert.AreEqual(Summary1, target.IntegrationSummaries[0]); } /// ///A test for Revision /// [TestMethod()] public void RevisionTest() { int revision = 99; int changelistid = 0; // TODO: Initialize to an appropriate value FileAction action = new FileAction(); // TODO: Initialize to an appropriate value DateTime date = new DateTime(); // TODO: Initialize to an appropriate value string username = string.Empty; // TODO: Initialize to an appropriate value FileType filetype = null; // TODO: Initialize to an appropriate value string description = string.Empty; // TODO: Initialize to an appropriate value string digest = string.Empty; int filesize = 0; PathSpec depotpath = null; // TODO: Initialize to an appropriate value string clientname = string.Empty; // TODO: Initialize to an appropriate value List integrationsummaries = null; // TODO: Initialize to an appropriate value FileHistory target = new FileHistory(revision, changelistid, action, date, username, filetype, description, digest, filesize, depotpath, clientname, integrationsummaries); // TODO: Initialize to an appropriate value int expected = revision; int actual; target.Revision = expected; actual = target.Revision; Assert.AreEqual(expected, actual); } /// ///A test for UserName /// [TestMethod()] public void UserNameTest() { int revision = 0; // TODO: Initialize to an appropriate value int changelistid = 0; // TODO: Initialize to an appropriate value FileAction action = new FileAction(); // TODO: Initialize to an appropriate value DateTime date = new DateTime(); // TODO: Initialize to an appropriate value string username = "filehistory_user"; FileType filetype = null; // TODO: Initialize to an appropriate value string description = string.Empty; // TODO: Initialize to an appropriate value string digest = string.Empty; int filesize = 0; PathSpec depotpath = null; // TODO: Initialize to an appropriate value string clientname = string.Empty; // TODO: Initialize to an appropriate value List integrationsummaries = null; // TODO: Initialize to an appropriate value FileHistory target = new FileHistory(revision, changelistid, action, date, username, filetype, description, digest, filesize, depotpath, clientname, integrationsummaries); // TODO: Initialize to an appropriate value string expected = string.Empty; // TODO: Initialize to an appropriate value string actual; target.UserName = expected; actual = target.UserName; Assert.AreEqual(expected, actual); } } }