public void AddDatabases() { var migrationManager = new MigrationManager(); var databaseMock = new Mock <IMongoDatabase>(); Assert.Throws <ArgumentNullException>(() => migrationManager.AddDatabase(null, "general")); Assert.Throws <ArgumentNullException>(() => migrationManager.AddDatabaseConnection(null, "general")); Assert.Throws <ArgumentNullException>(() => migrationManager.AddDatabase(databaseMock.Object, null)); Assert.Throws <ArgumentNullException>(() => migrationManager.AddDatabase(databaseMock.Object, "")); Assert.DoesNotThrow(() => migrationManager.AddDatabase(databaseMock.Object, "general")); }
public void GetDatabases() { var migrationManager = new MigrationManager(); Assert.Throws <ArgumentNullException>(() => migrationManager.GetDatabase(null)); Assert.Throws <ArgumentNullException>(() => migrationManager.GetDatabase("")); Assert.AreEqual(migrationManager.GetDatabase("unknown"), null); // add valid database var databaseMock = new Mock <IMongoDatabase>(); migrationManager.AddDatabase(databaseMock.Object, "general"); Assert.AreEqual(migrationManager.GetDatabase("general"), databaseMock.Object); }