public void DeleteTest() { bool unicode = false; string server = "localhost:6666"; string user = "******"; string pass = string.Empty; string ws_client = "admin_space"; for (int i = 0; i < 2; i++) // run once for ascii, once for unicode { Process p4d = Utilities.DeployP4TestServer(TestDir, unicode); try { using (P4Server target = new P4Server(server, user, pass, ws_client)) { P4Workspace actual = P4Workspace.Fetch(target, "admin_space"); Assert.IsNotNull(actual); actual.Delete(true); } } catch (Exception ex) { Assert.Fail("Exception Thrown: {0} : {1}", ex.ToString(), ex.Message); } finally { Utilities.RemoveTestServer(p4d, TestDir); } unicode = !unicode; } }
public void ParseTest() { P4Server pserver = new P4Server(false); P4Workspace target = new P4Workspace(pserver, "temp"); bool actual = target.Parse(spec); Assert.IsTrue(actual); Assert.AreEqual(target.Name, "XP1_usr"); }
public void RootTest() { P4Server pserver = null; P4Workspace target = new P4Workspace(pserver, "Fred"); string expected = "Handy Manny"; string actual; target.Root = expected; actual = target.Root; Assert.AreEqual(expected, actual); }
public void SubmitOptionsTest() { P4Server pserver = new P4Server(false); P4Workspace target = new P4Workspace(pserver, "Fred"); // possible values: "submitunchanged", "revertunchanged", "leaveunchanged", "submitunchanged+reopen", "revertunchanged+reopen", "leaveunchanged+reopen"; String spec = "submitunchanged"; P4Workspace.SubmitFlags expected = new P4Workspace.SubmitFlags(spec); P4Workspace.SubmitFlags actual; target.SubmitOptions = expected; actual = target.SubmitOptions; String formatted = actual.ToString(); Assert.AreEqual(spec, formatted); spec = "revertunchanged"; expected = new P4Workspace.SubmitFlags(spec); target.SubmitOptions = expected; actual = target.SubmitOptions; formatted = actual.ToString(); Assert.AreEqual(spec, formatted); spec = "leaveunchanged"; expected = new P4Workspace.SubmitFlags(spec); target.SubmitOptions = expected; actual = target.SubmitOptions; formatted = actual.ToString(); Assert.AreEqual(spec, formatted); spec = "submitunchanged+reopen"; expected = new P4Workspace.SubmitFlags(spec); target.SubmitOptions = expected; actual = target.SubmitOptions; formatted = actual.ToString(); Assert.AreEqual(spec, formatted); spec = "revertunchanged+reopen"; expected = new P4Workspace.SubmitFlags(spec); target.SubmitOptions = expected; actual = target.SubmitOptions; formatted = actual.ToString(); Assert.AreEqual(spec, formatted); spec = "leaveunchanged+reopen"; expected = new P4Workspace.SubmitFlags(spec); target.SubmitOptions = expected; actual = target.SubmitOptions; formatted = actual.ToString(); Assert.AreEqual(spec, formatted); }
public void ViewTest() { P4Server pserver = new P4Server(false); P4Workspace target = new P4Workspace(pserver, "Fred"); WorkspaceView expected = new WorkspaceView(pserver, new String[] { "//depot/a //workspace/a" }); WorkspaceView actual; target.View = expected; actual = target.View; Assert.AreEqual(expected.Count, actual.Count); Assert.AreEqual(expected.GetLeft(0), actual.GetLeft(0)); Assert.AreEqual(expected.GetRight(0), actual.GetRight(0)); Assert.AreEqual(expected.GetType(0), actual.GetType(0)); }
public void AltRootsTest() { P4Server pserver = null; P4Workspace target = new P4Workspace(pserver, "Fred"); StringList expected = new StringList(); expected.Add("Pooh Bear"); expected.Add("Smokey Bear"); StringList actual; target.AltRoots = expected; actual = target.AltRoots; Assert.AreEqual(expected, actual); }
public void ToStringTest() { P4Server pserver = new P4Server(false); P4Workspace target = new P4Workspace(pserver, "temp"); bool result = target.Parse(spec); Assert.IsTrue(result); Assert.AreEqual(target.Name, "XP1_usr"); String actual = target.ToString(); Assert.IsTrue(actual.StartsWith("Client:\tXP1_usr")); }
public void LineEndOptionsTest() { P4Server pserver = new P4Server(false); P4Workspace target = new P4Workspace(pserver, "Fred"); // possible values: local, unix, uac, win, share String spec = "local"; P4Workspace.LineEndFlags expected = new P4Workspace.LineEndFlags(spec); // P4Workspace.LineEndFlags actual; target.LineEndOptions = expected; actual = target.LineEndOptions; String formatted = actual.ToString(); Assert.AreEqual(spec, formatted); spec = "unix"; expected = new P4Workspace.LineEndFlags(spec); // target.LineEndOptions = expected; actual = target.LineEndOptions; formatted = actual.ToString(); Assert.AreEqual(spec, formatted); spec = "mac"; expected = new P4Workspace.LineEndFlags(spec); // target.LineEndOptions = expected; actual = target.LineEndOptions; formatted = actual.ToString(); Assert.AreEqual(spec, formatted); spec = "win"; expected = new P4Workspace.LineEndFlags(spec); // target.LineEndOptions = expected; actual = target.LineEndOptions; formatted = actual.ToString(); Assert.AreEqual(spec, formatted); spec = "share"; expected = new P4Workspace.LineEndFlags(spec); // target.LineEndOptions = expected; actual = target.LineEndOptions; formatted = actual.ToString(); Assert.AreEqual(spec, formatted); }
public void OptionsTest() { P4Server pserver = new P4Server(false); P4Workspace target = new P4Workspace(pserver, "Fred"); String spec = "noallwrite noclobber nocompress unlocked nomodtime normdir"; P4Workspace.ClientFlags expected = new P4Workspace.ClientFlags(spec); P4Workspace.ClientFlags actual; target.Options = expected; actual = target.Options; String formatted = actual.ToString(); Assert.AreEqual(spec, formatted); spec = "allwrite clobber compress locked modtime rmdir"; expected = new P4Workspace.ClientFlags(spec); target.Options = expected; actual = target.Options; formatted = actual.ToString(); Assert.AreEqual(spec, formatted); }
public void SaveTest() { bool unicode = false; string server = "localhost:6666"; string user = "******"; string pass = string.Empty; string ws_client = "admin_space"; for (int i = 0; i < 2; i++) // run once for ascii, once for unicode { Process p4d = Utilities.DeployP4TestServer(TestDir, unicode); try { using (P4Server target = new P4Server(server, user, pass, ws_client)) { P4Workspace actual = P4Workspace.Fetch(target, "admin_space"); Assert.IsNotNull(actual); String newDescription = "This is an new description"; actual.Description = newDescription; actual.Save(false); P4Workspace newActual = P4Workspace.Fetch(target, "admin_space"); Assert.AreEqual(newActual.Description.TrimEnd(' ', '\r', '\n'), newDescription); } } catch (Exception ex) { Assert.Fail("Exception Thrown: {0} : {1}", ex.ToString(), ex.Message); } finally { Utilities.RemoveTestServer(p4d, TestDir); } unicode = !unicode; } }