protected IDocumentDbService DbService() { if (dbService == null) { ICouchDbSettings config = new CouchDbSettings() { DatabaseName = "integration-" + DateTime.UtcNow.Ticks, Username = "", Password = "", Server = "http://127.0.0.1:5984" }; var couchDbServer = Environment.GetEnvironmentVariable(CouchDbServerEnvironmentVariable); if (!string.IsNullOrEmpty(couchDbServer)) { config.Server = couchDbServer; } var innerDbService = new CouchDbAccessService(config, new Mock <ILogger>().Object); innerDbService.Initialize().Wait(); innerDbService.AddViews("roles", CouchDbRoleStore.GetViews()).Wait(); innerDbService.AddViews("permissions", CouchDbPermissionStore.GetViews()).Wait(); var auditingDbService = new AuditingDocumentDbService(new Mock <IEventService>().Object, innerDbService); var cachingDbService = new CachingDocumentDbService(auditingDbService, new MemoryCache(new MemoryCacheOptions())); dbService = cachingDbService; } return(dbService); }
private BookOrderRepository CreateSut() { CouchDbSettings settings = new CouchDbSettings( Constants.DatabaseUri, _databaseName); return(new BookOrderRepository(settings)); }
public BookOrderRepository(CouchDbSettings settings) { _databaseUri = settings.DatabaseUri; _databaseName = settings.DatabaseName; }