コード例 #1
0
        public void RemoveMustRemoveEntityAndReturnEntityEntryWhenCalled()
        {
            Person person = new Person {
                FirstName = "Bob", LastName = "Smith"
            };
            MockDbSet <Person> persons = new MockDbSet <Person>(new[] { person });

            Assert.Contains(persons, x => x.Id == person.Id);
            EntityEntry <Person> entry = persons.Remove(person);

            Assert.Equal(person.Id, entry.Entity.Id);
            Assert.DoesNotContain(persons, x => x.Id == person.Id);
        }