public void CallDatabaseInitialize_FailConnectionStringNotValid() { var callInit = 0; var callResetConnect = 0; var connectionString = String.Empty; var connectionStringProvider = MockConnectionStringProvider.LazyMock(null, connectionString); var webConfigurationService = MockWebConfigurationService.LazyMock(null, true, null, null, () => callResetConnect++); var databaseInitializationService = MockDatabaseInitializationService.LazyMock(() => callInit++); var pathsService = MockPathsService.LazyMock(); var setupService = new SetupService(webConfigurationService, databaseInitializationService, connectionStringProvider, pathsService); var result = setupService.DatabaseInitialize(); Assert.IsFalse(result); Assert.AreEqual(0, callInit); Assert.AreEqual(1, callResetConnect); }
public void CallDatabaseInitialize_Success() { var callInit = 0; var connectionString = "ConnectionString"; var connectionStringProvider = MockConnectionStringProvider.LazyMock(null, connectionString); var webConfigurationService = MockWebConfigurationService.LazyMock(null, true); var databaseInitializationService = MockDatabaseInitializationService.LazyMock(() => callInit++); var pathsService = MockPathsService.LazyMock(); var setupService = new SetupService(webConfigurationService, databaseInitializationService, connectionStringProvider, pathsService); var result = setupService.DatabaseInitialize(); Assert.IsTrue(result); Assert.AreEqual(1, callInit); }