private async Task ShouldDeleteInstrument() { _apiClient.Setup(apiClient => apiClient.Delete <EmptyResponse>("instruments/instrument_id", _authorization, CancellationToken.None)) .ReturnsAsync(() => new EmptyResponse()); IInstrumentsClient client = new InstrumentsClient(_apiClient.Object, _configuration.Object); var response = await client.Delete("instrument_id"); response.ShouldNotBeNull(); }
private async Task ShouldGetInstrument() { var instrumentResponse = new RetrieveInstrumentResponse(); _apiClient.Setup(apiClient => apiClient.Get <RetrieveInstrumentResponse>("instruments/instrument_id", _authorization, CancellationToken.None)) .ReturnsAsync(() => instrumentResponse); IInstrumentsClient client = new InstrumentsClient(_apiClient.Object, _configuration.Object); var response = await client.Get("instrument_id"); response.ShouldNotBeNull(); response.ShouldBeSameAs(instrumentResponse); }
private async Task ShouldCreateInstrument() { var createInstrumentRequest = new CreateInstrumentRequest(); var createInstrumentResponse = new CreateInstrumentResponse(); _apiClient.Setup(apiClient => apiClient.Post <CreateInstrumentResponse>("instruments", _authorization, createInstrumentRequest, CancellationToken.None, null)) .ReturnsAsync(() => createInstrumentResponse); IInstrumentsClient client = new InstrumentsClient(_apiClient.Object, _configuration.Object); var response = await client.Create(createInstrumentRequest); response.ShouldNotBeNull(); response.ShouldBe(createInstrumentResponse); }
private async Task ShouldUpdateInstrument() { var updateInstrumentRequest = new UpdateInstrumentRequest(); var updateInstrumentResponse = new UpdateInstrumentResponse(); _apiClient.Setup(apiClient => apiClient.Patch <UpdateInstrumentResponse>("instruments/instrument_id", _authorization, updateInstrumentRequest, CancellationToken.None, null)) .ReturnsAsync(() => updateInstrumentResponse); IInstrumentsClient client = new InstrumentsClient(_apiClient.Object, _configuration.Object); var response = await client.Update("instrument_id", updateInstrumentRequest); response.ShouldNotBeNull(); response.ShouldBeSameAs(updateInstrumentResponse); }