public EntityStatesTest() { var dbContextFactory = new DbContextInMemoryFactory(nameof(EntityStatesTest)); _schoolDbContextSut = dbContextFactory.Create(); _schoolDbContextSut.Database.EnsureCreated(); }
public EntityTypesTest() { var dbContextFactory = new DbContextInMemoryFactory(DbName); _schoolDbContextSut = dbContextFactory.Create(); _schoolDbContextSut.Database.EnsureCreated(); }
public void LazyEvaluationTest() { IEnumerable <StudentEntity> students; using (var schoolDbContextSut = _dbContextFactory.Create()) { students = schoolDbContextSut.Students.Where(s => s.Id == Seed.StudentJane.Id); } //Materialized outside of using scope Assert.Throws <ObjectDisposedException>(() => students.ToList()); }
public AddressFacadeTests() { var dbContextFactory = new DbContextInMemoryFactory(nameof(AddressFacadeTests)); var dbx = dbContextFactory.Create(); dbx.Database.EnsureCreated(); var unitOfWork = new UnitOfWork(dbx); _repository = new RepositoryBase <AddressEntity>(unitOfWork); _mapper = new AddressMapper(); var entityFactory = new EntityFactory(dbx.ChangeTracker); _facadeSUT = new AddressFacade(unitOfWork, _repository, _mapper, entityFactory); }
public LinqLazyEvaluationTest() { _dbContextFactory = new DbContextInMemoryFactory(nameof(EntityStatesTest)); _schoolDbContextSut = _dbContextFactory.Create(); _schoolDbContextSut.Database.EnsureCreated(); }