public void MapResponseToRequest() { var mapper = new ApiDeviceModelMapper(); var model = new ApiDeviceResponseModel(); model.SetProperties(1, "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); ApiDeviceRequestModel response = mapper.MapResponseToRequest(model); response.Name.Should().Be("A"); response.PublicId.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiDeviceResponseModel model = await client.DeviceGetAsync(1); ApiDeviceModelMapper mapper = new ApiDeviceModelMapper(); UpdateResponse <ApiDeviceResponseModel> updateResponse = await client.DeviceUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiDeviceModelMapper mapper = new ApiDeviceModelMapper(); UpdateResponse <ApiDeviceResponseModel> updateResponse = await this.Client.DeviceUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }