public void MapResponseToRequest() { var mapper = new ApiPostHistoryTypeModelMapper(); var model = new ApiPostHistoryTypeResponseModel(); model.SetProperties(1, "A"); ApiPostHistoryTypeRequestModel response = mapper.MapResponseToRequest(model); response.Type.Should().Be("A"); }
public void MapClientRequestToResponse() { var mapper = new ApiPostHistoryTypeModelMapper(); var model = new ApiPostHistoryTypeClientRequestModel(); model.SetProperties("A"); ApiPostHistoryTypeClientResponseModel response = mapper.MapClientRequestToResponse(1, model); response.Should().NotBeNull(); response.RwType.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiPostHistoryTypeModelMapper(); var model = new ApiPostHistoryTypeRequestModel(); model.SetProperties("A"); JsonPatchDocument <ApiPostHistoryTypeRequestModel> patch = mapper.CreatePatch(model); var response = new ApiPostHistoryTypeRequestModel(); patch.ApplyTo(response); response.Type.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()); ApiPostHistoryTypeResponseModel model = await client.PostHistoryTypeGetAsync(1); ApiPostHistoryTypeModelMapper mapper = new ApiPostHistoryTypeModelMapper(); UpdateResponse <ApiPostHistoryTypeResponseModel> updateResponse = await client.PostHistoryTypeUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }