public void ItShouldGetAllProjectsForAGivenCollection() { var mockProxy = new Mock<ITFSProjectProxy>(); var projects = new List<Project>(); projects.Add(new Project { Name = "Project 01" }); projects.Add(new Project { Name = "Project 02" }); mockProxy.Setup(p => p.GetProjectsByProjectCollection()) .Returns(projects) .Verifiable(); var repository = new ProjectRepository(mockProxy.Object); var results = repository.GetAll(); Assert.IsTrue(results != null); Assert.IsTrue(results.SequenceEqual<Project>(projects), "The expected projects for a given collection don't much the results"); }
public void ItShouldGetOneProject() { var mockProxy = new Mock<ITFSProjectProxy>(); var projects = new List<Project>(); projects.Add(new Project { Name = "Project 01", Changesets = new List<Changeset>(), WorkItems = new List<WorkItem>(), Queries = new List<Query>(), Builds = new List<Build>() }); projects.Add(new Project { Name = "Project 02", Changesets = new List<Changeset>(), WorkItems = new List<WorkItem>(), Queries = new List<Query>(), Builds = new List<Build>() }); mockProxy.Setup(p => p.GetProjectsByProjectCollection()) .Returns(projects) .Verifiable(); var repository = new ProjectRepository(mockProxy.Object); var project = repository.GetOne("Project 01"); Assert.IsTrue(project != null); Assert.AreEqual(project.Name, "Project 01"); mockProxy.VerifyAll(); }