Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }