public void SetUp()
            {
                _fixture = new CustomAutoFixture();

                _expectedContextManageCount = _hasCurrentContext ? 0 : 1;

                _contextService = _fixture.Freeze <IContextService <DbContext_Fake> >();
                _dbSetService   = _fixture.Freeze <IDbSetService <DbContext_Fake, Foo> >();

                _context = new DbContext_Fake();

                _contextService.HasCurrentContext().Returns(_hasCurrentContext);
                _contextService.InitContext().Returns(_context);
                _contextService.GetCurrentContext().Returns(_context);

                _expectedEntity = _fixture.Create <Foo>();

                _dbSet = CreateDbSetSubstitute(_expectedEntity);
                _dbSet.FindAsync(_expectedEntity.FooId).Returns(_expectedEntity);

                _dbSetService.GetDbSet(Arg.Any <DbContext_Fake>())
                .Returns(_dbSet);

                _sut = _fixture.Create <ContextRepository <DbContext_Fake, Foo> >();
            }
            public void SetUp()
            {
                _fixture = new CustomAutoFixture();

                _expectedContextManageCount = _hasCurrentContext ? 0 : 1;

                _contextService = _fixture.Freeze <IContextService <DbContext_Fake> >();
                _dbSetService   = _fixture.Freeze <IDbSetService <DbContext_Fake, Foo> >();
                _flushService   = _fixture.Freeze <IFlushService <DbContext_Fake> >();

                _context = new DbContext_Fake();

                _contextService.HasCurrentContext().Returns(_hasCurrentContext);
                _contextService.InitContext().Returns(_context);
                _contextService.GetCurrentContext().Returns(_context);

                _dbSet = Substitute.For <DbSet <Foo>, IQueryable <Foo> >();

                _dbSetService.GetDbSet(Arg.Any <DbContext_Fake>())
                .Returns(_dbSet);

                _sut = _fixture.Create <ContextRepository <DbContext_Fake, Foo> >();

                _foo = _fixture.Create <Foo>();
            }
        public void SetUp()
        {
            _fixture = new CustomAutoFixture();

            _context = new DbContext_Fake();

            _contextService = _fixture.Freeze <IContextService <DbContext_Fake> >();
            _contextService.HasCurrentContext().Returns(false);
            _contextService.InitContext().Returns(_context);
            _contextService.GetCurrentContext().Returns(_context);

            _contextFlushService = _fixture.Freeze <IContextFlushService <DbContext_Fake> >();

            _sut = CreateSut(_transactionType);
        }
        public void SetUp()
        {
            _fixture = new CustomAutoFixture();

            _context = new DbContext_Fake();

            _contextService = _fixture.Freeze <IContextService <DbContext_Fake> >();
            _contextService.HasCurrentContext().Returns(false);
            _contextService.InitContext().Returns(_context);
            _contextService.GetCurrentContext().Returns(_context);

            _databaseFacade = (DatabaseFacade_Fake)_context.Database;

            _sut = _fixture.Create <DbContextTransactionUnitOfWork <DbContext_Fake> >();
        }