public void MapResponseToRequest() { var mapper = new ApiProvinceModelMapper(); var model = new ApiProvinceResponseModel(); model.SetProperties(1, 1, "A"); ApiProvinceRequestModel response = mapper.MapResponseToRequest(model); response.CountryId.Should().Be(1); response.Name.Should().Be("A"); }
public void MapClientRequestToResponse() { var mapper = new ApiProvinceModelMapper(); var model = new ApiProvinceClientRequestModel(); model.SetProperties(1, "A"); ApiProvinceClientResponseModel response = mapper.MapClientRequestToResponse(1, model); response.Should().NotBeNull(); response.CountryId.Should().Be(1); response.Name.Should().Be("A"); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiProvinceModelMapper mapper = new ApiProvinceModelMapper(); UpdateResponse <ApiProvinceResponseModel> updateResponse = await this.Client.ProvinceUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void CreatePatch() { var mapper = new ApiProvinceModelMapper(); var model = new ApiProvinceRequestModel(); model.SetProperties(1, "A"); JsonPatchDocument <ApiProvinceRequestModel> patch = mapper.CreatePatch(model); var response = new ApiProvinceRequestModel(); patch.ApplyTo(response); response.CountryId.Should().Be(1); 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()); ApiProvinceResponseModel model = await client.ProvinceGetAsync(1); ApiProvinceModelMapper mapper = new ApiProvinceModelMapper(); UpdateResponse <ApiProvinceResponseModel> updateResponse = await client.ProvinceUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }