예제 #1
0
        public void ItShouldGetAllChangesForAGivenChangeset()
        {
            var mockProxy = new Mock<ITFSChangeProxy>();
            var changes = new List<Change>();

            changes.Add(new Change { Changeset = 123, Path = "root>path1", ChangeType = "rename" });
            changes.Add(new Change { Changeset = 123, Path = "root>path2", ChangeType = "delete" });

            mockProxy.Setup(p => p.GetChangesByChangeset(123, int.MaxValue))
                 .Returns(changes)
                 .Verifiable();

            var repository = new ChangeRepository(mockProxy.Object);
            var operation = new ODataSelectManyQueryOperation();
            operation.Keys = new Dictionary<string, string>();
            operation.Keys.Add("Changeset", "123");
            var results = repository.GetChangesByChangeset(operation);

            Assert.IsTrue(results.SequenceEqual<Change>(changes), "The expected changes for a collection don't match the results");
            mockProxy.VerifyAll();
        }