public void CommitTest() { const string CollectionUrl = "http://FakeServer:8080/tfs/TestCollection"; const string TeamProjectName = "TestProject"; const int ChangesetId = 123; using (ShimsContext.Create()) { var checkInCalled = false; ShimWorkspace.AllInstances.CheckInWorkspaceCheckInParameters = (@this, x) => { checkInCalled = true; return ChangesetId; }; this.SetupTfsShim(CollectionUrl, TeamProjectName, ChangesetId, 3); var sc = new SourceControlWrapper(CollectionUrl, TeamProjectName); sc.CreateWorkspace(); sc.Commit("comment", "OverRide Comment"); Assert.IsTrue(checkInCalled); } }
public void CreateBranchTest() { const string CollectionUrl = "http://FakeServer:8080/tfs/TestCollection"; const string TeamProjectName = "TestProject"; const int PendingChangeCount = 1; using (ShimsContext.Create()) { var createBranchObjectCalled = false; ShimVersionControlServer.AllInstances.CreateBranchObjectBranchProperties = (@this, x) => { createBranchObjectCalled = true; }; var pendBranchCalled = false; ShimWorkspace.AllInstances.PendBranchStringStringVersionSpec = (@this, x, y, z) => { pendBranchCalled = true; return PendingChangeCount; }; this.SetupTfsShim(CollectionUrl, TeamProjectName, 123, PendingChangeCount); var sc = new SourceControlWrapper(CollectionUrl, TeamProjectName); sc.CreateWorkspace(); sc.CreateBranch("Main", "Dev"); Assert.IsTrue(createBranchObjectCalled); Assert.IsTrue(pendBranchCalled); } }
public void CreateFolderTest() { const string CollectionUrl = "http://FakeServer:8080/tfs/TestCollection"; const string TeamProjectName = "TestProject"; const int PendingChangeCount = 1; using (ShimsContext.Create()) { var pendAddCalled = false; ShimWorkspace.AllInstances.PendAddString = (@this, x) => { pendAddCalled = true; return PendingChangeCount; }; this.SetupTfsShim(CollectionUrl, TeamProjectName, 123, PendingChangeCount); var sc = new SourceControlWrapper(CollectionUrl, TeamProjectName); sc.CreateWorkspace(); ShimDirectoryInfo.ConstructorString = (@this, value) => { new ShimDirectoryInfo(@this) { ExistsGet = () => false, Create = () => { }, }; }; ShimDirectory.GetDemandDirStringBoolean = (fullPath, thisDirOnly) => System.IO.Path.GetTempPath(); sc.CreateFolder("$/TestProject/Main/Folder", true); Assert.IsTrue(pendAddCalled); } }
public void FileExistsTest() { const string CollectionUrl = "http://FakeServer:8080/tfs/TestCollection"; const string TeamProjectName = "TestProject"; using (ShimsContext.Create()) { this.SetupTfsShim(CollectionUrl, TeamProjectName, 123, 3); var sc = new SourceControlWrapper(CollectionUrl, TeamProjectName); sc.CreateWorkspace(); var result = sc.FileExist("testfile"); Assert.IsTrue(result, "Incorrect result for FileExists"); } }
public void CreateWorkspaceTest() { const string CollectionUrl = "http://FakeServer:8080/tfs/TestCollection"; const string TeamProjectName = "TestProject"; using (ShimsContext.Create()) { this.SetupTfsShim(CollectionUrl, TeamProjectName, 123, 1); var sc = new SourceControlWrapper(CollectionUrl, TeamProjectName); sc.CreateWorkspace(); } }