public void UseOracle_ThrowsIfServiceNameNull() { var optionsBuilder = new DbContextOptionsBuilder(); var goodBuilder = new DbContextOptionsBuilder <GoodDbContext>(); var config = new ConfigurationBuilder().Build(); string serviceName = null; var ex2 = Assert.Throws <ArgumentException>(() => OracleDbContextOptionsExtensions.UseOracle(optionsBuilder, config, serviceName)); Assert.Contains(nameof(serviceName), ex2.Message); var ex4 = Assert.Throws <ArgumentException>(() => OracleDbContextOptionsExtensions.UseOracle <GoodDbContext>(goodBuilder, config, serviceName)); Assert.Contains(nameof(serviceName), ex4.Message); }
public void UseOracle_ThrowsIfConfigurationNull() { var optionsBuilder = new DbContextOptionsBuilder(); var goodBuilder = new DbContextOptionsBuilder <GoodDbContext>(); IConfigurationRoot config = null; var ex = Assert.Throws <ArgumentNullException>(() => OracleDbContextOptionsExtensions.UseOracle(optionsBuilder, config)); Assert.Contains(nameof(config), ex.Message); var ex2 = Assert.Throws <ArgumentNullException>(() => OracleDbContextOptionsExtensions.UseOracle(optionsBuilder, config, "foobar")); Assert.Contains(nameof(config), ex2.Message); var ex3 = Assert.Throws <ArgumentNullException>(() => OracleDbContextOptionsExtensions.UseOracle <GoodDbContext>(goodBuilder, config)); Assert.Contains(nameof(config), ex3.Message); var ex4 = Assert.Throws <ArgumentNullException>(() => OracleDbContextOptionsExtensions.UseOracle <GoodDbContext>(goodBuilder, config, "foobar")); Assert.Contains(nameof(config), ex4.Message); }
public void UseOracle_ThrowsIfDbContextOptionsBuilderNull() { // Arrange DbContextOptionsBuilder optionsBuilder = null; DbContextOptionsBuilder <GoodDbContext> goodBuilder = null; IConfigurationRoot config = null; // Act and Assert var ex = Assert.Throws <ArgumentNullException>(() => OracleDbContextOptionsExtensions.UseOracle(optionsBuilder, config)); Assert.Contains(nameof(optionsBuilder), ex.Message); var ex2 = Assert.Throws <ArgumentNullException>(() => OracleDbContextOptionsExtensions.UseOracle(optionsBuilder, config, "foobar")); Assert.Contains(nameof(optionsBuilder), ex2.Message); var ex3 = Assert.Throws <ArgumentNullException>(() => OracleDbContextOptionsExtensions.UseOracle <GoodDbContext>(goodBuilder, config)); Assert.Contains(nameof(optionsBuilder), ex3.Message); var ex4 = Assert.Throws <ArgumentNullException>(() => OracleDbContextOptionsExtensions.UseOracle <GoodDbContext>(goodBuilder, config, "foobar")); Assert.Contains(nameof(optionsBuilder), ex4.Message); }