Пример #1
0
        public void Clear_RemovesAllItems()
        {
            var expectedItems = new List <TestItem>
            {
                new TestItem(),
                new TestItem(),
                new TestItem()
            };
            var subject = new ChangeTrackingCollection <TestItem>(expectedItems);

            subject.Clear();
            Assert.True(subject.HasChanges);
            Assert.Empty(subject);
        }
Пример #2
0
        public void GetChangeSet_AddAfterClear_Correct()
        {
            var expectedItems = new List <string>
            {
                "Value1",
                "Value2",
                "Value3"
            };
            var addItems = new List <string>
            {
                "Value1",
                "Value2",
                "Value3",
                "Value4"
            };
            var subject = new ChangeTrackingCollection <string>(expectedItems);

            subject.Clear();
            addItems.ForEach(item => subject.Add(item));
            var changes = subject.GetChangeSet(ChangePath.Empty);

            Assert.Single(changes);
            Assert.Single(changes.First().Value);
        }