public void MapResponseToRequest() { var mapper = new ApiPaymentTypeModelMapper(); var model = new ApiPaymentTypeResponseModel(); model.SetProperties(1, "A"); ApiPaymentTypeRequestModel response = mapper.MapResponseToRequest(model); response.Name.Should().Be("A"); }
public void MapClientRequestToResponse() { var mapper = new ApiPaymentTypeModelMapper(); var model = new ApiPaymentTypeClientRequestModel(); model.SetProperties("A"); ApiPaymentTypeClientResponseModel response = mapper.MapClientRequestToResponse(1, model); response.Should().NotBeNull(); response.Name.Should().Be("A"); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiPaymentTypeModelMapper mapper = new ApiPaymentTypeModelMapper(); UpdateResponse <ApiPaymentTypeResponseModel> updateResponse = await this.Client.PaymentTypeUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void CreatePatch() { var mapper = new ApiPaymentTypeModelMapper(); var model = new ApiPaymentTypeRequestModel(); model.SetProperties("A"); JsonPatchDocument <ApiPaymentTypeRequestModel> patch = mapper.CreatePatch(model); var response = new ApiPaymentTypeRequestModel(); patch.ApplyTo(response); response.Name.Should().Be("A"); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiPaymentTypeResponseModel model = await client.PaymentTypeGetAsync(1); ApiPaymentTypeModelMapper mapper = new ApiPaymentTypeModelMapper(); UpdateResponse <ApiPaymentTypeResponseModel> updateResponse = await client.PaymentTypeUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }