public void ShouldCreateProviderUsingOptions() { var factory = new MongoDatabaseProviderFactory(); var options = new Dictionary<string, string> { { MongoDatabaseProviderFactory.kDatabaseOption, "mydatabase" }, {MongoDatabaseProviderFactory.kHostOption, "localhost"} }; }
public void ShouldCreateProviderUsingConnectionString() { var factory = new MongoDatabaseProviderFactory(); var options = new Dictionary<string, string> { { MongoDatabaseProviderFactory.kConnectionStringOption, "mongodb://127.0.0.1" }, {MongoDatabaseProviderFactory.kDatabaseOption, "mydatabase"} }; Assert.DoesNotThrow(() => factory.CreateProvider(options)); }
public void ShouldNotCreateProviderWhenDatabaseOptionIsMissing() { var factory = new MongoDatabaseProviderFactory(); var options = new Dictionary<string, string> { { MongoDatabaseProviderFactory.kConnectionStringOption, "mongodb://127.0.0.1/database" }, }; try { factory.CreateProvider(options); Assert.Fail("Exception was not throwed"); } catch { Assert.Pass(); } }