public async Task WhenGetItemsAsyncWithoutPartitionId_ThenClientMakesAQueryWithoutPartitionIdAndEnablesCrossPartition() { // Arrange string ownerId = "o00042"; var repo = new CosmosRepository <InternalDroneUtilization>( _clientMockObject, _optionsMockObject, _loggerDebug, _metricsTrackerMockObject); // Act var res = await repo.GetItemsAsync( new QueryDefinition("SELECT *"), null); // Assert Assert.NotNull(res); Assert.Equal(_fakeResults.Count(), res.Count()); Assert.All( res, r => { Assert.Equal(ownerId, r.PartitionKey); Assert.Equal(typeof(InternalDroneUtilization).Name, r.DocumentType); }); Mock.Get(_containerMockObject) .Verify(c => c.GetItemQueryIterator <InternalDroneUtilization>( It.IsAny <QueryDefinition>(), null, It.Is <QueryRequestOptions>(ro => ro.PartitionKey == null))); }
public async Task <IEnumerable <Service> > GetPendingServices() { var ThisService = await CosmosRepository <Service> .GetItemsAsync(d => d.Type == "PendingService"); return(ThisService); }
public async Task <IEnumerable <Stories> > GetAllStoriesForService(string Service) { var ThisStory = await CosmosRepository <Stories> .GetItemsAsync(d => d.Type == "Story" && d.ServiceId == Service); return(ThisStory); }
public async Task <IEnumerable <Stories> > GetAllStories() { var ThisStory = await CosmosRepository <Stories> .GetItemsAsync(d => d.Type == "Story"); return(ThisStory); }