public void TestGetReleasebranches_valid_branch() { // Arrange IConvention convention = Substitute.For<IConvention>(); convention.GetReleaseBranchesPath(AKISBV).Returns(SERVERITEM); this.VersionControlAdapter.GetItemsByPath(convention.GetReleaseBranchesPath(AKISBV)).Returns(new[] { SERVER_BASEPATH_AKISBV_5_0_35 }); BranchInfo branch; convention.TryGetBranchInfoByServerPath(SERVER_BASEPATH_AKISBV_5_0_35, out branch).Returns(BranchInfoOut(AKISBV_5_0_35)); IVersionControlService versionControlService = new TeamFoundationService(this.VersionControlAdapter, convention, new TextOutputServiceDummy()); // Act ISet<BranchInfo> branches = versionControlService.GetReleasebranches(AKISBV); // Assert CollectionAssert.AreEqual(new[] { AKISBV_5_0_35 }, branches.ToArray()); }
public void TestGetBranchInfoByChangeset_multiple_branches() { // Arrange IConvention convention = Substitute.For<IConvention>(); convention.GetBranchInfoByServerPath(SERVER_PATH_AKISBV_5_0_35).Returns(AKISBV_5_0_35); convention.GetBranchInfoByServerPath(SERVER_PATH_AKISBV_MAIN).Returns(AKISBV_MAIN); this.VersionControlAdapter.GetServerItemsByChangeset(CHANGESETNUMBER).Returns(new[] { SERVER_PATH_AKISBV_5_0_35, SERVER_PATH_AKISBV_MAIN }); IVersionControlService versionControlService = new TeamFoundationService(this.VersionControlAdapter, convention, new TextOutputServiceDummy()); // Act versionControlService.GetBranchInfoByChangeset(CHANGESETNUMBER); }
public void TestGetBranchInfo_single_branch() { // Arrange IConvention convention = Substitute.For<IConvention>(); this.VersionControlAdapter.GetServerItemsByChangeset(CHANGESETNUMBER).Returns(new[] { SERVERITEM, OTHER_SERVERITEM }); convention.GetBranchInfoByServerPath(SERVERITEM).Returns(AKISBV_MAIN); convention.GetBranchInfoByServerPath(OTHER_SERVERITEM).Returns(AKISBV_MAIN); IVersionControlService versionControlService = new TeamFoundationService(this.VersionControlAdapter, convention, new TextOutputServiceDummy()); // Act BranchInfo branch = versionControlService.GetBranchInfoByChangeset(CHANGESETNUMBER); // Assert Assert.AreEqual(AKISBV_MAIN, branch); }
public void TestGetBranchInfoByChangeset() { // Arrange IConvention convention = Substitute.For<IConvention>(); convention.GetBranchInfoByServerPath(ANY_STRING).ReturnsForAnyArgs(AKISBV_5_0_35); this.VersionControlAdapter.GetServerItemsByChangeset(CHANGESETNUMBER).Returns(new[] { SERVER_PATH_AKISBV_5_0_35 }); IVersionControlService versionControlService = new TeamFoundationService(this.VersionControlAdapter, convention, new TextOutputServiceDummy()); // Act BranchInfo branch = versionControlService.GetBranchInfoByChangeset(CHANGESETNUMBER); // Assert Assert.AreEqual(AKISBV_5_0_35, branch); }