コード例 #1
0
        public void MustAdd1Item()
        {
            var originalCollection = GetOriginalCollection();
            var keyProperties      = GetKeyPropertiesMock();
            var newCollection      = GetOriginalCollection();

            var newEntry = new FakeClass {
                Value = "New entry"
            };

            newCollection.Add(newEntry);

            // Run test
            var resultingCollection = Merge(originalCollection, newCollection, keyProperties);

            Assert.AreEqual(4, resultingCollection.Count);
            Assert.IsTrue(resultingCollection.Contains(newEntry), "Resulting collection is supposed to contain the new entry");
        }
コード例 #2
0
        public void MustNotRemoveItemsWhenAdding()
        {
            var originalCollection = GetOriginalCollection();
            var keyProperties      = GetKeyPropertiesMock();
            var newCollection      = GetOriginalCollection();

            var newEntry = new FakeClass {
                Value = "New entry"
            };

            newCollection.Add(newEntry);

            // Run test
            IList <FakeClass> removedEntries = null;
            var resultingCollection          = Merge(originalCollection, newCollection, keyProperties, ref removedEntries);

            Assert.IsNull(removedEntries, "Not supposed to remove any entries when simply adding new entries");
        }