Пример #1
0
        public EntityStatesTest()
        {
            var dbContextFactory = new DbContextInMemoryFactory(nameof(EntityStatesTest));

            _schoolDbContextSut = dbContextFactory.Create();
            _schoolDbContextSut.Database.EnsureCreated();
        }
Пример #2
0
        public EntityTypesTest()
        {
            var dbContextFactory = new DbContextInMemoryFactory(DbName);

            _schoolDbContextSut = dbContextFactory.Create();
            _schoolDbContextSut.Database.EnsureCreated();
        }
Пример #3
0
        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());
        }
Пример #4
0
        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);
        }
Пример #5
0
 public LinqLazyEvaluationTest()
 {
     _dbContextFactory   = new DbContextInMemoryFactory(nameof(EntityStatesTest));
     _schoolDbContextSut = _dbContextFactory.Create();
     _schoolDbContextSut.Database.EnsureCreated();
 }