/// <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); }
/// <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)); }
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 ) )); }
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))); }