Esempio n. 1
0
        public EfCarSystemDbSetCocoon(ICarSystemEfDbContext carSystemDbContext)
        {
            Guard.WhenArgument(carSystemDbContext, nameof(ICarSystemEfDbContext)).IsNull().Throw();

            this.Context = carSystemDbContext;
            this.DbSet   = this.Context.Set <T>();
        }
        public void Constructor_Should_ThrowArgumentNullException_IfDbContextPassedIsNull()
        {
            // Arrange
            ICarSystemEfDbContext nullContext = null;

            // Act & Assert
            Assert.That(() => new EfCarSystemDbSetCocoon <IAdvert>(nullContext),
                        Throws.InstanceOf <ArgumentNullException>().With.Message.Contains(nameof(ICarSystemEfDbContext)));
        }
        public void Contructor_Should_ThrowArgumentNullException_IfPassedDbContextIsNull()
        {
            // Arrange
            ICarSystemEfDbContext dbContextThatIsNull = null;

            // Act & Assert
            Assert.That(
                () => new CarSystemDbContextSaveChanges(dbContextThatIsNull),
                Throws.InstanceOf <ArgumentNullException>().With.Message.Contains("carSystemEfDbContext"));
        }
        public CarSystemDbContextSaveChanges(ICarSystemEfDbContext carSystemEfDbContext)
        {
            Guard.WhenArgument(carSystemEfDbContext, nameof(carSystemEfDbContext)).IsNull().Throw();

            this.carSystemEfDbContext = carSystemEfDbContext;
        }