示例#1
0
        public void FileSystemChangeTracker_Returns_changes()
        {
            var changeTracker = new FileSystemChangeTracker();

            changeTracker.AddChange(new FileSystemChangeInformation()
            {
                FileContents         = "abc",
                FullPath             = "DummyPath1",
                FileSystemChangeType = FileSystemChangeType.AddFile
            });

            Assert.Single(changeTracker.Changes);
            Assert.Equal("DummyPath1", changeTracker.Changes.First().FullPath);
            Assert.Equal("abc", changeTracker.Changes.First().FileContents);

            changeTracker.AddChange(new FileSystemChangeInformation()
            {
                FileContents         = "def",
                FullPath             = "DummyPath2",
                FileSystemChangeType = FileSystemChangeType.EditFile
            });

            Assert.Equal(2, changeTracker.Changes.Count());
            Assert.Equal("DummyPath2", changeTracker.Changes.First(p => p.FullPath.Equals("DummyPath2")).FullPath);
            Assert.Equal("def", changeTracker.Changes.First(p => p.FullPath.Equals("DummyPath2")).FileContents);
        }
示例#2
0
        public void FileSystemChangeTracker_Returns_Last_change()
        {
            var changeTracker = new FileSystemChangeTracker();

            changeTracker.AddChange(new FileSystemChangeInformation()
            {
                FileContents         = "abc",
                FullPath             = "DummyPath",
                FileSystemChangeType = FileSystemChangeType.AddFile
            });

            Assert.Single(changeTracker.Changes);
            Assert.Equal("DummyPath", changeTracker.Changes.First().FullPath);
            Assert.Equal("abc", changeTracker.Changes.First().FileContents);

            changeTracker.AddChange(new FileSystemChangeInformation()
            {
                FileContents         = "def",
                FullPath             = "DummyPath",
                FileSystemChangeType = FileSystemChangeType.AddFile
            });

            Assert.Single(changeTracker.Changes);
            Assert.Equal("DummyPath", changeTracker.Changes.First().FullPath);
            Assert.Equal("def", changeTracker.Changes.First().FileContents);
        }
示例#3
0
        public void FileSystemChangeTracker_ClearChanges()
        {
            var changeTracker = new FileSystemChangeTracker();

            changeTracker.AddChange(new FileSystemChangeInformation()
            {
                FileContents         = "abc",
                FullPath             = "DummyPath1",
                FileSystemChangeType = FileSystemChangeType.AddFile
            });

            Assert.Single(changeTracker.Changes);
            Assert.Equal("DummyPath1", changeTracker.Changes.First().FullPath);
            Assert.Equal("abc", changeTracker.Changes.First().FileContents);

            changeTracker.ClearChanges();
            Assert.Empty(changeTracker.Changes);
        }