public void ItShouldGetAllWorkItemsForAGivenChangeset() { var mockProxy = new Mock<ITFSWorkItemProxy>(); var items = new List<WorkItem>(); items.Add(new WorkItem { Id = 1, Description = "This is the first WorkItem", CreatedBy = "johndoe", Priority = "1", Title = "Bug #1" }); items.Add(new WorkItem { Id = 1, Description = "This is the second WorkItem", CreatedBy = "mary", Priority = "5", Title = "Bug #2" }); mockProxy.Setup(p => p.GetWorkItemsByChangeset(123)) .Returns(items) .Verifiable(); var repository = new WorkItemRepository(mockProxy.Object); var results = repository.GetWorkItemsByChangeset("123"); Assert.IsTrue(results.SequenceEqual<WorkItem>(items), "The expected workitems for a changeset don't match the results"); mockProxy.VerifyAll(); }
public void ItShouldGetAllWorkItemsForAGivenBuild() { var mockProxy = new Mock<ITFSWorkItemProxy>(); var items = new List<WorkItem>(); items.Add(new WorkItem { Id = 1, Description = "This is the first WorkItem", CreatedBy = "johndoe", Priority = "1", Title = "Bug #1" }); items.Add(new WorkItem { Id = 1, Description = "This is the second WorkItem", CreatedBy = "mary", Priority = "5", Title = "Bug #2" }); mockProxy.Setup(p => p.GetWorkItemsByBuild("Sample Project", "123", It.IsAny<FilterNode>())) .Returns(items) .Verifiable(); var repository = new WorkItemRepository(mockProxy.Object); var operation = new ODataSelectManyQueryOperation(); operation.Keys = new Dictionary<string, string>(); operation.Keys.Add("project", "Sample Project"); operation.Keys.Add("number", "123"); var results = repository.GetWorkItemsByBuild(operation); Assert.IsTrue(results.SequenceEqual<WorkItem>(items), "The expected workitems for a build don't match the results"); mockProxy.VerifyAll(); }
public void ItShouldGetAllWorkItemsForAGivenCollection() { var mockProxy = new Mock<ITFSWorkItemProxy>(); var items = new List<WorkItem>(); items.Add(new WorkItem { Id = 1, Description = "This is the first WorkItem", CreatedBy = "johndoe", Priority = "1", Title = "Bug #1" }); items.Add(new WorkItem { Id = 1, Description = "This is the second WorkItem", CreatedBy = "mary", Priority = "5", Title = "Bug #2" }); mockProxy.Setup(p => p.GetWorkItemsByProjectCollection(It.IsAny<FilterNode>())) .Returns(items) .Verifiable(); var repository = new WorkItemRepository(mockProxy.Object); var results = repository.GetAll(new ODataSelectManyQueryOperation()); Assert.IsTrue(results.SequenceEqual<WorkItem>(items), "The expected queries for a collection don't match the results"); mockProxy.VerifyAll(); }
public void ItShouldGetOneWorkItem() { var mockProxy = new Mock<ITFSWorkItemProxy>(); var item = new WorkItem { Id = 1, Description = "This is the first WorkItem", CreatedBy = "johndoe", Priority = "1", Title = "Bug #1" }; mockProxy.Setup(p => p.GetWorkItem(1)) .Returns(item) .Verifiable(); var repository = new WorkItemRepository(mockProxy.Object); var result = repository.GetOne("1"); Assert.IsTrue(result != null); Assert.AreEqual(result, item); }