public void GetMgLatestIteration_Returns_Null_If_Migration_Table_Does_Not_Exist() { DbMock.MigrationTableExists(false); ConfigManagerMock.ConfigReturns(null); var command = new GetMgLatestIteration(GetMockedDependencies()) { Database = "database", Host = "host", Port = 1111, Schema = "public", Username = "******" }; var result = command.Invoke()?.OfType <IterationResult>(); Assert.Empty(result); }
public void GetMgLatestIteration_Returns_Records() { DbMock.MigrationTableExists(true); DbMock.GetLatestIteration(1); ConfigManagerMock.ConfigReturns(null); var command = new GetMgLatestIteration(GetMockedDependencies()) { Database = "database", Host = "host", Port = 1111, Schema = "public", Username = "******" }; var result = command.Invoke()?.OfType <IterationResult>()?.First(); Assert.NotNull(result); Assert.Equal(1, result.Iteration); }