Esempio n. 1
0
        protected async Task <DocumentDbAccess> CreateDbAccess(ServiceDbConfigManager configManager, int collectionRuLimit = 1000)
        {
            var dbAccess = new DocumentDbAccess(CreateDbConfig(_databaseId, collectionRuLimit), configManager);

            _dbAccesses.Add(dbAccess);

            await dbAccess.Open();

            return(dbAccess);
        }
        private async Task <DocumentDbAccess> CreateDbAccess(IDocumentClient documentClient)
        {
            var signatureGenerator = Substitute.For <IServiceConfigSignatureGenerator>();

            var configManager = new ServiceDbConfigManager("Test", signatureGenerator);

            var queryPolicy = Substitute.For <IDocumentQueryPolicy>();

            queryPolicy.GetIdSearchLimit(Arg.Any <ICollection <string> >()).Returns(1000);
            queryPolicy.IsQueryValid(Arg.Any <string>()).Returns(true);

            var dbService = Substitute.For <IDocumentDbService>();

            var documentDbAccess = new DocumentDbAccess(CreateDbConfig(), configManager, documentClient, dbService, queryPolicy);

            await documentDbAccess.Open(new IDocumentStoreConfigSource[0]);

            return(documentDbAccess);
        }