/// <summary>
 /// Check <see cref="ICollectionService"/> for more information
 /// </summary>
 /// <param name="query">Check <see cref="ICollectionService"/> for more information</param>
 /// <returns>Check <see cref="ICollectionService"/> for more information</returns>
 public async Task CreateCollectionAsync(CreateCollectionQuery query)
 {
     await _requestSender.SendRequestAsync(new ApiRequest
     {
         Path       = $"/api/v4/collections/",
         HTTPMethod = HttpMethod.Post,
         Query      = query,
     }).ConfigureAwait(false);
 }
示例#2
0
        /// <summary>
        /// Check <see cref="ICollectionsManager"/> for more information
        /// </summary>
        /// <param name="query">Check <see cref="ICollectionsManager"/> for more information</param>
        /// <returns>Check <see cref="ICollectionsManager"/> for more information</returns>
        public Task CreateCollectionAsync(CreateCollectionQuery query)
        {
            var request = new Request <string>
            {
                Uri                 = $"/api/v4/collections/",
                HTTPMethod          = HttpMethod.Post,
                Query               = query,
                DeserializeResponse = false
            };

            return(_requestSender.SendRequestAsync(request));
        }
示例#3
0
        public async Task CreateCollectionCallsRequestSenderWithValidRequest()
        {
            var result = new { message = "Created", statuscode = 201 };

            _apiRequestSenderMock.Setup(sender => sender.SendRequestAsync(It.IsAny <ApiRequest>()))
            .ReturnsAsync(result);
            var createCollectionQuery = new CreateCollectionQuery("name");
            await _collectionService.CreateCollectionAsync(createCollectionQuery);

            _apiRequestSenderMock.Verify(sender => sender.SendRequestAsync(
                                             It.Is <ApiRequest>(
                                                 req => req.Path == "/api/v4/collections/" &&
                                                 req.HTTPMethod == HttpMethod.Post &&
                                                 req.Query == createCollectionQuery
                                                 )
                                             ));
        }
示例#4
0
        public async Task CreateCollectionCallsRequestSenderWithValidRequest()
        {
            var apiRequestSender = new Mock <IApiRequestSender>();
            var result           = "";

            apiRequestSender.Setup(sender => sender.SendRequestAsync(It.IsAny <Request <string> >()))
            .Returns(Task.FromResult(result));
            var collectionService     = new CollectionService(apiRequestSender.Object);
            var createCollectionQuery = new CreateCollectionQuery("name");
            await collectionService.CreateCollectionAsync(createCollectionQuery);

            apiRequestSender.Verify(sender => sender.SendRequestAsync(
                                        It.Is <Request <string> >(
                                            req => req.Path == "/api/v4/collections/" &&
                                            req.HTTPMethod == HttpMethod.Post &&
                                            req.Query == createCollectionQuery &&
                                            req.DeserializeResponse == false)));
        }