using Perforce.P4; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; namespace p4api.net.unit.test { /// <summary> ///This is a test class for JobTest and is intended ///to contain all JobTest Unit Tests ///</summary> [TestClass()] public class JobTest { 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 public static string JobSpec = @"# A Perforce Job Specification. # # Job: The job name. 'new' generates a sequenced job number. # Status: Either 'open', 'closed', or 'suspended'. Can be changed. # User: The user who created the job. Can be changed. # Date: The date this specification was last modified. # Description: Comments about the job. Required. Job: new Status: open User: admin Description: Fred's sub shop Pet Street Sally Mae"; /// <summary> ///A test for Parse ///</summary> [TestMethod()] public void ParseTest() { Job target = new Job(); // TODO: Initialize to an appropriate value string spec = JobSpec; target.Parse(spec); Assert.AreEqual("admin",target["User"]); } /// <summary> ///A test for FromJobCmdTaggedOutput ///</summary> [TestMethod()] public void FromJobCmdTaggedOutputTest() { Job target = new Job(); TaggedObject obj = new TaggedObject(); obj["Job"] = "Job007"; obj["Status"] = "opem"; obj["User"] = "BondJameBond"; obj["Description"] = "License to kill"; obj["Movie0"] = "Dr. No"; obj["Movie1"] = "From Russia With Love"; obj["Movie2"] = "Goldfinger"; obj["Movie3"] = "Thunderball"; obj["Movie4"] = "You Only Live Twice"; obj["Movie5"] = "On Her Majesty's Secret Service"; // 6 and 7 swapped obj["Movie7"] = "Live And Let Die"; obj["Movie6"] = "Diamonds Are Forever"; obj["Movie8"] = "The Man With The Golden Gun"; obj["Movie9"] = "The Spy Who Loved Me"; obj["Movie10"] = "Moonraker"; obj["Movie11"] = "For Your Eyes Only"; obj["Movie12"] = "Octopussy"; obj["Movie13"] = "Never Say Never Again"; obj["Movie14"] = "A View To A Kill"; obj["Movie15"] = "The Living Daylights"; obj["Movie16"] = "License To Kill"; obj["Movie17"] = "GoldenEye"; obj["Movie18"] = "Tomorrow Never Dies"; obj["Movie19"] = "The World Is Not Enough"; obj["Movie20"] = "Die Another Day"; obj["Movie21"] = "Casino Royale"; obj["Movie22"] = "Quantum of Solace"; // skipped 23 obj["Movie24"] = "Extras"; target.FromJobCmdTaggedOutput(obj); Assert.AreEqual("BondJameBond", target["User"]); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 19640 | Liz Lam | "Forking branch Main of perforce-software-p4connect to liz_lam-p4connect." | ||
//guest/perforce_software/p4connect/main/src/P4Bridge/p4api.net-unit-test/JobTest.cs | |||||
#1 | 16209 | Norman Morse | Move entire source tree into "main" branch so workshop code will act correctly. | ||
//guest/perforce_software/p4connect/src/P4Bridge/p4api.net-unit-test/JobTest.cs | |||||
#2 | 12135 | Norman Morse |
Integrate dev branch changes into main. This code is the basiis of the 2.7 BETA release which provides Unity 5 compatibility |
||
#1 | 10940 | Norman Morse |
Inital Workshop release of P4Connect. Released under BSD-2 license |