예제 #1
0
        public void ConstructorShouldThrowException_WhenDbContextIsNull()
        {
            // Arrange & Act;
            ISportSquareDbContext db = null;

            // Assert
            Assert.Throws <ArgumentNullException>(() => new UnitOfWork.UnitOfWork(db));
        }
예제 #2
0
        public void ConstructorShouldThrowException_WhenDbContextIsNull()
        {
            // Arrange
            ISportSquareDbContext dbContext = null;

            Assert.That(
                () => new GenericRepository <IDbModel>(dbContext),
                Throws.InstanceOf <ArgumentNullException>().With.Message.Contains("DbContext"));
        }
예제 #3
0
        public UnitOfWork(ISportSquareDbContext dbContext)
        {
            if (dbContext == null)
            {
                throw new ArgumentNullException("DbContext can't be null");
            }

            this.dbContext = dbContext;
        }
예제 #4
0
        public GenericRepository(ISportSquareDbContext dbContext)
        {
            if (dbContext == null)
            {
                throw new ArgumentNullException("DbContext can't be null");
            }

            this.dbContext = dbContext;
            this.dbSet     = this.DbContext.Set <TEntity>();

            if (this.dbSet == null)
            {
                throw new ArgumentNullException("This DbSet<{0}> doesn't exist in DbContext", typeof(TEntity).Name);
            }
        }
예제 #5
0
 public VenueRepository(ISportSquareDbContext dbContext) : base(dbContext)
 {
 }
예제 #6
0
 public FakeGenericRepository(ISportSquareDbContext dbContext) : base(dbContext)
 {
 }