public void MapResponseToRequest() { var mapper = new ApiTableModelMapper(); var model = new ApiTableResponseModel(); model.SetProperties(1, "A"); ApiTableRequestModel response = mapper.MapResponseToRequest(model); response.Name.Should().Be("A"); }
public void MapClientRequestToResponse() { var mapper = new ApiTableModelMapper(); var model = new ApiTableClientRequestModel(); model.SetProperties("A"); ApiTableClientResponseModel response = mapper.MapClientRequestToResponse(1, model); response.Should().NotBeNull(); response.Name.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiTableModelMapper(); var model = new ApiTableRequestModel(); model.SetProperties("A"); JsonPatchDocument <ApiTableRequestModel> patch = mapper.CreatePatch(model); var response = new ApiTableRequestModel(); patch.ApplyTo(response); response.Name.Should().Be("A"); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiTableModelMapper mapper = new ApiTableModelMapper(); UpdateResponse <ApiTableResponseModel> updateResponse = await this.Client.TableUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiTableResponseModel model = await client.TableGetAsync(1); ApiTableModelMapper mapper = new ApiTableModelMapper(); UpdateResponse <ApiTableResponseModel> updateResponse = await client.TableUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }