public void MapResponseToRequest() { var mapper = new ApiPostTypeModelMapper(); var model = new ApiPostTypeResponseModel(); model.SetProperties(1, "A"); ApiPostTypeRequestModel response = mapper.MapResponseToRequest(model); response.Type.Should().Be("A"); }
public void MapClientRequestToResponse() { var mapper = new ApiPostTypeModelMapper(); var model = new ApiPostTypeClientRequestModel(); model.SetProperties("A"); ApiPostTypeClientResponseModel response = mapper.MapClientRequestToResponse(1, model); response.Should().NotBeNull(); response.RwType.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiPostTypeModelMapper(); var model = new ApiPostTypeRequestModel(); model.SetProperties("A"); JsonPatchDocument <ApiPostTypeRequestModel> patch = mapper.CreatePatch(model); var response = new ApiPostTypeRequestModel(); 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()); ApiPostTypeResponseModel model = await client.PostTypeGetAsync(1); ApiPostTypeModelMapper mapper = new ApiPostTypeModelMapper(); UpdateResponse <ApiPostTypeResponseModel> updateResponse = await client.PostTypeUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }