public void ThrowArgumentNullException_WhenDbContextParameterIsNull()
        {
            IProgrammersSpotDbContext nullContext = null;

            Assert.That(
                () => new ProgrammersSpot.Business.Data.UnitOfWork.UnitOfWork(nullContext),
                Throws.InstanceOf <ArgumentNullException>().With.Message.Contains("Db context"));
        }
Ejemplo n.º 2
0
        public void ShouldThrowArgumentNullException_WhenDbContextIsNull()
        {
            // Arrange
            IProgrammersSpotDbContext nullDbContext = null;

            // Act & Assert
            Assert.That(() => new GenericRepository <IRegularUser>(nullDbContext),
                        Throws.InstanceOf <ArgumentNullException>().With.Message.Contains("An instance of DbContext is required to use this repository."));
        }
 public GenericRepository(IProgrammersSpotDbContext context)
 {
     if (context == null)
     {
         throw new ArgumentNullException("An instance of DbContext is required to use this repository.", "context");
     }
     this.context = context;
     this.dbSet   = this.context.Set <T>();
 }
Ejemplo n.º 4
0
 public CityRepository(IProgrammersSpotDbContext dbContext)
     : base(dbContext)
 {
 }
Ejemplo n.º 5
0
        public UnitOfWork(IProgrammersSpotDbContext context)
        {
            Guard.WhenArgument(context, "Db context").IsNull().Throw();

            this.context = context;
        }