public void AddDbContext_ThrowsIfServiceNameNull()
        {
            // Arrange
            IServiceCollection services    = new ServiceCollection();
            IConfigurationRoot config      = null;
            string             serviceName = null;

            // Act and Assert
            var ex = Assert.Throws <ArgumentNullException>(() => OracleDbContextServiceCollectionExtensions.AddDbContext <GoodOracleDbContext>(services, config, serviceName));

            Assert.Contains(nameof(serviceName), ex.Message);
        }
Exemplo n.º 2
0
        public void AddDbContext_ThrowsIfConfigurationNull()
        {
            IServiceCollection services = new ServiceCollection();
            IConfigurationRoot config   = null;

            var ex = Assert.Throws <ArgumentNullException>(() => OracleDbContextServiceCollectionExtensions.AddDbContext <GoodOracleDbContext>(services, config));

            Assert.Contains(nameof(config), ex.Message);

            var ex2 = Assert.Throws <ArgumentNullException>(() => OracleDbContextServiceCollectionExtensions.AddDbContext <GoodOracleDbContext>(services, config, "foobar"));

            Assert.Contains(nameof(config), ex2.Message);
        }