コード例 #1
0
 public async Task <dynamic> GetSubTopicsAsync(TopicInput topicInput)
 {
     if (topicInput.IsShared)
     {
         return(await dbClient.FindItemsWhereArrayContainsAsync(dbSettings.TopicsCollectionId, Constants.ParentTopicId, Constants.Id, topicInput.Id));
     }
     else
     {
         return(await dbClient.FindItemsWhereArrayContainsAsyncWithLocation(dbSettings.TopicsCollectionId, Constants.ParentTopicId, Constants.Id, topicInput.Id, topicInput.Location));
     }
 }
コード例 #2
0
        public void FindItemsWhereArrayContainsAsyncWithLocation()
        {
            // Arrange
            Location location = new Location {
                State = "Hawaii", City = "Honolulu", County = "Honolulu", ZipCode = "96801"
            };
            var ids = new List <string>()
            {
                "guid1", "guid2", "guid3"
            };
            string query = "SELECT * FROM c WHERE  ARRAY_CONTAINS(c.topicTags, { 'id' : 'System.Collections.Generic.List`1[System.String]'}) AND  (ARRAY_CONTAINS(c.location,{\"state\":\"Hawaii\",\"county\":\"Honolulu\",\"city\":\"Honolulu\",\"zipCode\":\"96801\"},true))";

            // Act
            dynamicQueries.FindItemsWhereArrayContainsAsyncWithLocation("TopicsCollections", "topicTags", "id", ids.ToString(), location);

            // Assert
            cosmosDbService.Received().QueryItemsAsync(Arg.Any <string>(), query);
        }