public TestingContext(Action <ICosmosDbBuilder> builderCallback, Action <ICosmosDbRepositoryBuilder> repoBuilderCallback) { var services = TestFramework.Services; DbConfig = services.GetRequiredService <IOptions <CosmosDbConfig> >().Value; TestConfig = services.GetRequiredService <IOptions <TestConfig> >().Value.Clone(); EnvConfig = services.GetRequiredService <IOptions <EnvironmentConfig> >().Value; if (EnvConfig.RandomizeCollectionName) { TestConfig.CollectionName = $"{TestConfig.CollectionName}{Guid.NewGuid()}"; } DbClient = new DocumentClient(new Uri(DbConfig.DbEndPoint), DbConfig.DbKey); var builder = new CosmosDbBuilder() .WithId(DbConfig.DbName) .WithDefaultThroughput(400) .AddCollection <T>(TestConfig.CollectionName, repoBuilderCallback); builderCallback?.Invoke(builder); CosmosDb = builder.Build(DbClient); Repo = CosmosDb.Repository <T>(); }
public Queue(ICosmosDb cosmosDb) { _queueRepository = cosmosDb.Repository <QueueDocument>(); }
public Stores(ICosmosDb cosmosDb) { _storeRepository = cosmosDb.Repository <StoreDocument>(); }