Exemple #1
0
        private async Task <bool> DocumentExistsAsync(TDocument document)
        {
            var cosmosDbQueryRepository = new QueryCosmosDbRepository <TEntity, TDocument>(CosmosDbConfiguration, _mapper);

            var cosmosDocumentResponse = await cosmosDbQueryRepository.GetByIdAsync(document.DocumentId, document.PartitionKey).ConfigureAwait(false);

            var entity = cosmosDocumentResponse.Entities.FirstOrDefault();

            return(!EqualityComparer <TEntity> .Default.Equals(entity, default));
        }
Exemple #2
0
        public async Task SetupAsync()
        {
            _cosmosDbConfiguration = new CosmosDbConfiguration("https://localhost:8081",
                                                               "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==", "People", "PeopleCollection");

            _mapper = MappingConfiguration.Configure(new MappingProfile());

            _queryCosmosDbRepository = new QueryCosmosDbRepository <Entities.Person, Person>(_cosmosDbConfiguration, _mapper);

            _querySameEntityAndDocumentCosmosDbRepository = new QueryCosmosDbRepository <Entities.Person, Entities.Person>(_cosmosDbConfiguration, _mapper);

            _peopleListToTest = await IntegrationTestsUtils.AddDocumentListToTestAsync(_cosmosDbConfiguration, _mapper).ConfigureAwait(false);
        }