public void MapResponseToRequest() { var mapper = new ApiSpaceFeatureModelMapper(); var model = new ApiSpaceFeatureResponseModel(); model.SetProperties(1, "A"); ApiSpaceFeatureRequestModel response = mapper.MapResponseToRequest(model); response.Name.Should().Be("A"); }
public void MapClientRequestToResponse() { var mapper = new ApiSpaceFeatureModelMapper(); var model = new ApiSpaceFeatureClientRequestModel(); model.SetProperties("A"); ApiSpaceFeatureClientResponseModel response = mapper.MapClientRequestToResponse(1, model); response.Should().NotBeNull(); response.Name.Should().Be("A"); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiSpaceFeatureModelMapper mapper = new ApiSpaceFeatureModelMapper(); UpdateResponse <ApiSpaceFeatureResponseModel> updateResponse = await this.Client.SpaceFeatureUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void CreatePatch() { var mapper = new ApiSpaceFeatureModelMapper(); var model = new ApiSpaceFeatureRequestModel(); model.SetProperties("A"); JsonPatchDocument <ApiSpaceFeatureRequestModel> patch = mapper.CreatePatch(model); var response = new ApiSpaceFeatureRequestModel(); 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()); ApiSpaceFeatureResponseModel model = await client.SpaceFeatureGetAsync(1); ApiSpaceFeatureModelMapper mapper = new ApiSpaceFeatureModelMapper(); UpdateResponse <ApiSpaceFeatureResponseModel> updateResponse = await client.SpaceFeatureUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }