private async Task ShouldCreateAndUpdateInstrument()
        {
            var createInstrumentResponse = await CreateTokenInstrument();

            var updateInstrumentRequest = new UpdateInstrumentRequest
            {
                Name        = "New Name",
                ExpiryMonth = 12,
                ExpiryYear  = 2026,
            };

            var update = await PreviousApi.InstrumentsClient().Update(createInstrumentResponse.Id, updateInstrumentRequest);

            update.ShouldNotBeNull();
            update.HttpStatusCode.ShouldNotBeNull();
            update.ResponseHeaders.ShouldNotBeNull();
            update.Body.ShouldNotBeNull();

            var retrieveInstrumentResponse = await PreviousApi.InstrumentsClient().Get(createInstrumentResponse.Id);

            retrieveInstrumentResponse.ShouldNotBeNull();
            retrieveInstrumentResponse.Name.ShouldBe("New Name");
            retrieveInstrumentResponse.ExpiryMonth.ShouldBe(12);
            retrieveInstrumentResponse.ExpiryYear.ShouldBe(2026);
        }
 public Task <UpdateInstrumentResponse> Update(string instrumentId,
                                               UpdateInstrumentRequest updateInstrumentRequest,
                                               CancellationToken cancellationToken = default)
 {
     CheckoutUtils.ValidateParams("instrumentId", instrumentId, "updateInstrumentRequest",
                                  updateInstrumentRequest);
     return(ApiClient.Patch <UpdateInstrumentResponse>(BuildPath(InstrumentsPath, instrumentId),
                                                       SdkAuthorization(),
                                                       updateInstrumentRequest,
                                                       cancellationToken));
 }
        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);
        }