public void RemoveRecurseCommandLineTest() { using (new ProcessControllerFactoryRestorer(new FakeProcessControlFactory())) { var processControl = new FakeProcessObserver<string>(); Plastic.RemoveItems(new[] {"a.txt", "b.cs"}, true, "C:\\temp", processControl, CancellationToken.None); Assert.AreEqual("cm.exe remove -R a.txt b.cs", processControl.CommandLine); Assert.AreEqual("C:\\temp", processControl.WorkingDir); } }
public void TestUndoCheckoutCommandLine() { using (new ProcessControllerFactoryRestorer(new FakeProcessControlFactory())) { var processControl = new FakeProcessObserver<Unit, string>(); Plastic.UndoCheckout(null, @"b:\cm\build", false, processControl, CancellationToken.None); Assert.AreEqual(@"cm.exe undocheckout", processControl.CommandLine); Assert.AreEqual(@"b:\cm\build", processControl.WorkingDir); } }
public void AddCommandLineTest() { using (new ProcessControllerFactoryRestorer(new FakeProcessControlFactory())) { var processControl = new FakeProcessObserver<AddedInfo>(); Plastic.AddItems(new[] {"a.txt", "b.cs"}, false, "C:\\temp", processControl, CancellationToken.None); Assert.AreEqual("cm.exe add a.txt b.cs", processControl.CommandLine); Assert.AreEqual("C:\\temp", processControl.WorkingDir); } }
public void TestUndoCheckoutAllWithPathsCommandLine() { using (new ProcessControllerFactoryRestorer(new FakeProcessControlFactory())) { var processControl = new FakeProcessObserver<Unit, string>(); Plastic.UndoCheckout(new[] {"a.txt", @"d:\foo\b.txt"}, @"b:\cm\build", true, processControl, CancellationToken.None); Assert.AreEqual(@"cm.exe undocheckout --all ""a.txt"" ""d:\foo\b.txt""", processControl.CommandLine); Assert.AreEqual(@"b:\cm\build", processControl.WorkingDir); } }
public void FileInfoCommandLineTest() { using (new ProcessControllerFactoryRestorer(new FakeProcessControlFactory())) { var processControl = new FakeProcessObserver<FileInfo>(); Plastic.GetFileInfo(new[] {"a.txt", "b.cs"}, "C:\\temp", processControl, CancellationToken.None); Assert.AreEqual("cm.exe fileinfo - --xml --encoding=utf-8", processControl.CommandLine); Assert.AreEqual("C:\\temp", processControl.WorkingDir); } }
public void CheckinCommandLineTest() { using (new ProcessControllerFactoryRestorer(new FakeProcessControlFactory())) { var processControl = new FakeProcessObserver<CheckinResult, ProcessProgressData>(); Plastic.Checkin(new[] {"a.txt", "b.cs"}, "C:\\temp", new CheckinOptions {All = true, Message = "Foobar"}, processControl, CancellationToken.None); Assert.AreEqual("cm.exe checkin --all -m \"Foobar\" \"a.txt\" \"b.cs\"", processControl.CommandLine); Assert.AreEqual("C:\\temp", processControl.WorkingDir); } }
public void ParseGetStatusCommandLine() { using (new ProcessControllerFactoryRestorer(new FakeProcessControlFactory())) { var processControl = new FakeProcessObserver<StatusChangeInfo>(); var options = new StatusOptions {FindAdded = true, FindLocallyDeleted = true}; Plastic.GetStatus(null, @"b:\cm\build", options, processControl, CancellationToken.None); Assert.AreEqual(@"cm.exe status --xml --encoding=utf-8 --added --localdeleted ", processControl.CommandLine); Assert.AreEqual(@"b:\cm\build", processControl.WorkingDir); } }
public void AddChangelistsCommandLine() { using (new ProcessControllerFactoryRestorer(new FakeProcessControlFactory())) { var processControl = new FakeProcessObserver<Unit>(); const string ChangelistName = "AAA"; const string Workspace = "C:\\temp\\Foo"; Plastic.AddChangelist(Workspace, ChangelistName, processControl); var expected = String.Format("cm.exe changelist add \"{0}\"", ChangelistName); Assert.AreEqual(expected, processControl.CommandLine); Assert.AreEqual(Workspace, processControl.WorkingDir); } }
public void AddChangelistsDescriptionPersistedCommandLine() { using (new ProcessControllerFactoryRestorer(new FakeProcessControlFactory())) { var processControl = new FakeProcessObserver<Unit>(); const string ChangelistName = "AAA"; const string Workspace = "C:\\temp"; const string Description = "My changelist desc"; Plastic.AddChangelist(Workspace, ChangelistName, processControl, Description, true); var expected = String.Format("cm.exe changelist add \"{0}\" \"{1}\" persistent", ChangelistName, Description); Assert.AreEqual(expected, processControl.CommandLine); Assert.AreEqual(Workspace, processControl.WorkingDir); } }
public void AddChangelistItemsCommandLine() { using (new ProcessControllerFactoryRestorer(new FakeProcessControlFactory())) { var processControl = new FakeProcessObserver<Unit>(); const string ChangelistName = "AAA"; const string Workspace = "C:\\temp"; var items = new[] {"a.txt", "D:\\Foo\\bar.cs"}; Plastic.AddChangelistItem(Workspace, ChangelistName, items, processControl); const string Expected = "cm.exe changelist \"AAA\" add \"a.txt\" \"D:\\Foo\\bar.cs\""; Assert.AreEqual(Expected, processControl.CommandLine); Assert.AreEqual(Workspace, processControl.WorkingDir); } }
public void MakeWritableXLinkCmdlineTest() { using (new ProcessControllerFactoryRestorer(new FakeProcessControlFactory())) { var observer = new FakeProcessObserver<XLinkInfo>(); var libGit2Workspace = PlasticTestHelpers.LibGit2Workspace; var path = Path.Combine(libGit2Workspace.Path, "ExampleData"); var options = new XLinkCreateOptions {Writable = true}; Plastic.MakeXlinkToChangeset(path, 4711, "ExampleData@dice-plastic:1:8087", options, libGit2Workspace.Path, observer, CancellationToken.None); var expected = string.Format("cm.exe xlink -w {0} / 4711@{1}", path, "ExampleData@dice-plastic:1:8087"); Assert.AreEqual(expected, observer.CommandLine); } }
public void GetAnAttributeCommandLineTest() { using (new ProcessControllerFactoryRestorer(new FakeProcessControlFactory())) { var processControl = new FakeProcessObserver<AttributeInfo>(); var attributeBuilder = new AttributeFindFilterBuilder(); attributeBuilder.AddDateRange(new DateTime(2013, 10, 10), new DateTime(2013, 10, 15)); attributeBuilder.AddRepositoryString(new[] {PlasticTestHelpers.LibGit2Workspace.Repository}); Plastic.GetAttributes(attributeBuilder.ToString(), Environment.CurrentDirectory, processControl, CancellationToken.None); Assert.AreEqual( "cm.exe find attribute where date between '2013-10-10T00:00:00.0000000+02:00' and '2013-10-15T00:00:00.0000000+02:00' on repository 'libgit2@localhost:8087' --xml --encoding=utf-8", processControl.CommandLine); Assert.AreEqual(Environment.CurrentDirectory, processControl.WorkingDir); } }
public void GetChangelistsCommandLine() { using (new ProcessControllerFactoryRestorer(new FakeProcessControlFactory())) { var wi = PlasticTestHelpers.LibGit2Workspace; var processControl = new FakeProcessObserver<ChangelistInfo>(); Plastic.GetChangelists(wi.Path, processControl, CancellationToken.None); Assert.AreEqual("cm.exe changelist", processControl.CommandLine); Assert.AreEqual(wi.Path, processControl.WorkingDir); } }
public void UpdateXLinkCmdlineTest() { using (new ProcessControllerFactoryRestorer(new FakeProcessControlFactory())) { var observer = new FakeProcessObserver<XLinkInfo>(); var libGit2Workspace = PlasticTestHelpers.LibGit2Workspace; var path = Path.Combine(libGit2Workspace.Path, "ExampleData"); Plastic.UpdateXlinkToBranch(path, "/main", "ExampleData@dice-plastic:1:8087", libGit2Workspace.Path, observer, CancellationToken.None); var expected = string.Format("cm.exe xlink -e {0} br:/main@{1}", path, "ExampleData@dice-plastic:1:8087"); Assert.AreEqual(expected, observer.CommandLine); } }