public void State_GetsMapped(EntityState revoState, System.Data.Entity.EntityState efState) { var entityEntry = new InMemoryCrudRepository.EntityEntry(new Entity1(), revoState); InMemoryDbEntityEntry sut = new InMemoryDbEntityEntry(entityEntry); sut.State.Should().Be(efState); }
public void Entity_GetsEntityInstance() { var entityEntry = new InMemoryCrudRepository.EntityEntry(new Entity1(), EntityState.Unchanged); InMemoryDbEntityEntry sut = new InMemoryDbEntityEntry(entityEntry); sut.Entity.Should().Be(entityEntry.Instance); }
public void Reference_CurrentValueGetsProperty() { var entity = new Entity1(); var entityEntry = new InMemoryCrudRepository.EntityEntry(entity, EntityState.Unchanged); InMemoryDbEntityEntry <Entity1> sut = new InMemoryDbEntityEntry <Entity1>(entityEntry); sut.Reference(x => x.Other).CurrentValue.Should().BeSameAs(entity.Other); }
public void Collection_CurrentValueGetsCollection() { var entity = new Entity1(); var entityEntry = new InMemoryCrudRepository.EntityEntry(entity, EntityState.Unchanged); InMemoryDbEntityEntry <Entity1> sut = new InMemoryDbEntityEntry <Entity1>(entityEntry); sut.Collection(x => x.Children).CurrentValue.Should().BeSameAs(entity.Children); }
public void CurrentValue_GetsMemberValue() { var entityEntry = new InMemoryCrudRepository.EntityEntry(new Entity1() { Foo = 5 }, EntityState.Unchanged); InMemoryDbMemberEntry <Entity1, int> sut = new InMemoryDbMemberEntry <Entity1, int>(x => x.Foo, entityEntry); sut.CurrentValue.Should().Be(5); }
public void Name_ReturnsPropertyName() { var entityEntry = new InMemoryCrudRepository.EntityEntry(new Entity1() { Foo = 5 }, EntityState.Unchanged); InMemoryDbMemberEntry <Entity1, int> sut = new InMemoryDbMemberEntry <Entity1, int>(x => x.Foo, entityEntry); sut.Name.Should().Be("Foo"); }
public InMemoryDbMemberEntry(Expression <Func <TEntity, TProperty> > navigationProperty, InMemoryCrudRepository.EntityEntry entityEntry) { NavigationProperty = navigationProperty; EntityEntry = entityEntry; PropertyInfo = (NavigationProperty.Body as MemberExpression)?.Member as PropertyInfo; if (PropertyInfo == null) { throw new ArgumentException($"Cannot retrieve property info from entity member expression: {navigationProperty}"); } }
public InMemoryDbEntityEntry(InMemoryCrudRepository.EntityEntry entityEntry) : base(entityEntry) { }
public InMemoryDbCollectionEntry(Expression <Func <TEntity, ICollection <TElement> > > navigationProperty, InMemoryCrudRepository.EntityEntry entityEntry) : base(navigationProperty, entityEntry) { }
public InMemoryDbEntityEntry(InMemoryCrudRepository.EntityEntry entityEntry) { this.EntityEntry = entityEntry; }
public InMemoryDbReferenceEntry(Expression <Func <TEntity, TProperty> > navigationProperty, InMemoryCrudRepository.EntityEntry entityEntry) : base(navigationProperty, entityEntry) { }