public void IsDatabaseFullyUpgraded_returns_false_if_lazy_upgrader_throws_exception(IConnectionStringProvider connectionStringProvider, ILog logger) { // Arrange var sut = new SqliteDatabaseTester(new Lazy <IConnectionStringProvider>(() => connectionStringProvider), new Lazy <IPerformsDatabaseUpgrades>(() => { throw new Exception(); }), logger); // Act var result = sut.IsDatabaseFullyUpgraded(); // Assert Assert.That(result, Is.False); }
public void IsDatabaseFullyUpgraded_returns_true_if_upgrader_returns_empty_set_of_upgrades(IConnectionStringProvider connectionStringProvider, IPerformsDatabaseUpgrades upgrader, ILog logger) { // Arrange Mock.Get(upgrader).Setup(x => x.GetPendingUpgrades()).Returns(new IUpgradeName[0]); var sut = new SqliteDatabaseTester(new Lazy <IConnectionStringProvider>(() => connectionStringProvider), new Lazy <IPerformsDatabaseUpgrades>(() => upgrader), logger); // Act var result = sut.IsDatabaseFullyUpgraded(); // Assert Assert.That(result, Is.True); }
public void IsDatabaseFullyUpgraded_returns_false_if_upgrader_throws_exception(IConnectionStringProvider connectionStringProvider, IPerformsDatabaseUpgrades upgrader, ILog logger) { // Arrange Mock.Get(upgrader).Setup(x => x.GetPendingUpgrades()).Throws <Exception>(); var sut = new SqliteDatabaseTester(new Lazy <IConnectionStringProvider>(() => connectionStringProvider), new Lazy <IPerformsDatabaseUpgrades>(() => upgrader), logger); // Act var result = sut.IsDatabaseFullyUpgraded(); // Assert Assert.That(result, Is.False); }
public void IsDatabaseFullyUpgraded_returns_false_if_upgrader_returns_upgrades_to_be_done(IConnectionStringProvider connectionStringProvider, IPerformsDatabaseUpgrades upgrader, IUpgradeName upgrade, ILog logger) { // Arrange Mock.Get(upgrader).Setup(x => x.GetPendingUpgrades()).Returns(new [] { upgrade }); var sut = new SqliteDatabaseTester(new Lazy <IConnectionStringProvider>(() => connectionStringProvider), new Lazy <IPerformsDatabaseUpgrades>(() => upgrader), logger); // Act var result = sut.IsDatabaseFullyUpgraded(); // Assert Assert.That(result, Is.False); }