コード例 #1
0
        public void ShouldThrowArgumentNullExceptionWithCorrectMessage_WhenIWhenItsDoneDbContextParameterIsNull()
        {
            IWhenItsDoneDbContext invalidDbContext = null;

            Assert.That(
                () => new GenericAsyncRepository <IDbModel>(invalidDbContext),
                Throws.InstanceOf <ArgumentNullException>().With.Message.Contains("DbContext"));
        }
コード例 #2
0
        public void ThrowArgumentNullException_WhenDbContextParameterIsNull()
        {
            IWhenItsDoneDbContext invalidDbContextParameter = null;

            Assert.That(
                () => new UnitOfWork(invalidDbContextParameter),
                Throws.InstanceOf <ArgumentNullException>().With.Message.Contains("DbContext"));
        }
コード例 #3
0
        public UnitOfWork(IWhenItsDoneDbContext dbContext)
        {
            if (dbContext == null)
            {
                throw new ArgumentNullException("DbContext");
            }

            this.dbContext = dbContext;
        }
コード例 #4
0
        public GenericAsyncRepository(IWhenItsDoneDbContext dbContext)
        {
            if (dbContext == null)
            {
                throw new ArgumentNullException("DbContext");
            }

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

            if (this.dbSet == null)
            {
                throw new ArgumentException("DbContext does not contain DbSet<{0}>", typeof(TEntity).Name);
            }
        }
コード例 #5
0
 public ProfilePicturesAsyncRepository(IWhenItsDoneDbContext dbContext)
     : base(dbContext)
 {
 }
コード例 #6
0
 public DishesAsyncRepository(IWhenItsDoneDbContext dbContext)
     : base(dbContext)
 {
 }
コード例 #7
0
 public WorkerAsyncRepository(IWhenItsDoneDbContext dbContext)
     : base(dbContext)
 {
 }