public void ConstructorShouldThrowException_WhenDbContextIsNull() { // Arrange & Act; ISportSquareDbContext db = null; // Assert Assert.Throws <ArgumentNullException>(() => new UnitOfWork.UnitOfWork(db)); }
public void ConstructorShouldThrowException_WhenDbContextIsNull() { // Arrange ISportSquareDbContext dbContext = null; Assert.That( () => new GenericRepository <IDbModel>(dbContext), Throws.InstanceOf <ArgumentNullException>().With.Message.Contains("DbContext")); }
public UnitOfWork(ISportSquareDbContext dbContext) { if (dbContext == null) { throw new ArgumentNullException("DbContext can't be null"); } this.dbContext = dbContext; }
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); } }
public VenueRepository(ISportSquareDbContext dbContext) : base(dbContext) { }
public FakeGenericRepository(ISportSquareDbContext dbContext) : base(dbContext) { }