public void GetSettingsRepository_should_return_correct_lightspeedrepository(string provider, string connectionString, DataProvider expectedProvider) { // Arrange var factory = new RepositoryFactory(provider, connectionString); SetUnitOfWork(factory); // Act ISettingsRepository repository = factory.GetSettingsRepository(provider, connectionString); // Assert LightSpeedSettingsRepository lightSpeedRepository = repository as LightSpeedSettingsRepository; Assert.That(lightSpeedRepository, Is.Not.Null); }
public void listall_should_return_all_databases() { // Arrange var factory = new RepositoryFactory("database name", "not empty"); SetUnitOfWork(factory); // Act List<RepositoryInfo> all = factory.ListAll().ToList(); // Assert Assert.That(all.Count, Is.EqualTo(4)); Assert.That(all.First(), Is.Not.Null); Assert.That(all.First().Id, Is.Not.Null.Or.Empty); }
public void GetSettingsRepository_should_default_to_sqlserver_lightspeedrepository() { // Arrange string provider = "anything"; string connectionString = "connection-string"; var factory = new RepositoryFactory(provider, connectionString); SetUnitOfWork(factory); // Act ISettingsRepository repository = factory.GetSettingsRepository(provider, connectionString); // Assert LightSpeedSettingsRepository lightSpeedRepository = repository as LightSpeedSettingsRepository; Assert.That(lightSpeedRepository, Is.Not.Null); }
public void GetSettingsRepository_should_return_mongodb_repository() { // Arrange string provider = "MONGODB"; string connectionString = "mongodb-connection-string"; var factory = new RepositoryFactory(provider, connectionString); SetUnitOfWork(factory); // Act ISettingsRepository repository = factory.GetSettingsRepository(provider, connectionString); // Assert MongoDBSettingsRepository mongoDbRepository = repository as MongoDBSettingsRepository; Assert.That(mongoDbRepository, Is.Not.Null); Assert.That(mongoDbRepository.ConnectionString, Is.EqualTo(connectionString)); }
private void SetUnitOfWork(RepositoryFactory factory) { factory.UnitOfWorkFunc = context => new UnitOfWork(); }