public void ConstructorMustInitializeExpressionWhenCalled() { Person person = new Person { FirstName = "Bob", LastName = "Smith" }; StubMockDbSet <Person> persons = new StubMockDbSet <Person>(new[] { person }); Assert.NotNull(persons.Expression); Assert.NotNull(persons.Provider); Assert.Contains(persons.Provider.CreateQuery <Person>(persons.Expression), x => x.Id == person.Id); }
public void AddMustAddEntityAndReturnEntityEntryWhenCalled() { StubMockDbSet <Person> persons = new StubMockDbSet <Person>(); Person person = new Person { FirstName = "Bob", LastName = "Smith" }; EntityEntry <Person> entry = persons.Add(person); Assert.Equal(person.Id, entry.Entity.Id); Assert.Contains(persons.EntitiesGetter, x => x.Id == person.Id); }