public void ItShouldGetAllBranchesForAGivenProject() { var mockProxy = new Mock<ITFSBranchProxy>(); var branches = new List<Branch>(); branches.Add(new Branch { Path = "myproject>root", Description = "This is the trunk" }); branches.Add(new Branch { Path = "myproject>branch1", Description = "This is one branch" }); branches.Add(new Branch { Path = "myproject>branch2", Description = "This is another branch" }); mockProxy.Setup(p => p.GetBranchesByProject("myproject")) .Returns(branches) .Verifiable(); var repository = new BranchRepository(mockProxy.Object); var results = repository.GetBranchesByProject("myproject"); Assert.IsTrue(results.SequenceEqual<Branch>(branches), "The expected branches for a project don't match the results"); mockProxy.VerifyAll(); }
public void ItShouldGetOneBranch() { var mockProxy = new Mock<ITFSBranchProxy>(); var branches = new List<Branch>(); var expectedResult = new Branch { Path = "myproject>root", Description = "This is the trunk" }; branches.Add(expectedResult); branches.Add(new Branch { Path = "myproject>branch1", Description = "This is one branch" }); branches.Add(new Branch { Path = "myproject>branch2", Description = "This is another branch" }); mockProxy.Setup(p => p.GetBranch(EntityTranslator.DecodePath("myproject>root"))) .Returns(expectedResult) .Verifiable(); var repository = new BranchRepository(mockProxy.Object); var result = repository.GetOne("myproject>root"); Assert.IsTrue(result != null); Assert.AreEqual(result.Path, expectedResult.Path); Assert.AreEqual(result.Description, expectedResult.Description); }