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); }
public void CallIsConnectionStringValid_Fail() { var connectionString = String.Empty; var connectionStringProvider = MockConnectionStringProvider.LazyMock(null, connectionString); var webConfigurationService = MockWebConfigurationService.LazyMock(); var databaseInitializationService = MockDatabaseInitializationService.LazyMock(); var pathsService = MockPathsService.LazyMock(); var setupService = new SetupService(webConfigurationService, databaseInitializationService, connectionStringProvider, pathsService); var result = setupService.IsConnectionStringValid(); Assert.IsFalse(result); }
public void CallSetConnect_CallSetConnectionString() { var callSetConnectionStringCount = 0; var connectionString = String.Empty; var connectionStringProvider = MockConnectionStringProvider.LazyMock(); var webConfigurationService = MockWebConfigurationService.LazyMock(null, null, null, () => callSetConnectionStringCount++); var databaseInitializationService = MockDatabaseInitializationService.LazyMock(); var pathsService = MockPathsService.LazyMock(); var setupService = new SetupService(webConfigurationService, databaseInitializationService, connectionStringProvider, pathsService); setupService.SetConnect(@".\SQL", "cEditor", "cEditor", "cEditor"); Assert.AreEqual(1, callSetConnectionStringCount); }