public void MapResponseToRequest() { var mapper = new ApiTimestampCheckModelMapper(); var model = new ApiTimestampCheckResponseModel(); model.SetProperties(1, "A", BitConverter.GetBytes(1)); ApiTimestampCheckRequestModel response = mapper.MapResponseToRequest(model); response.Name.Should().Be("A"); response.Timestamp.Should().BeEquivalentTo(BitConverter.GetBytes(1)); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiTimestampCheckModelMapper mapper = new ApiTimestampCheckModelMapper(); UpdateResponse <ApiTimestampCheckResponseModel> updateResponse = await this.Client.TimestampCheckUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void CreatePatch() { var mapper = new ApiTimestampCheckModelMapper(); var model = new ApiTimestampCheckRequestModel(); model.SetProperties("A", BitConverter.GetBytes(1)); JsonPatchDocument <ApiTimestampCheckRequestModel> patch = mapper.CreatePatch(model); var response = new ApiTimestampCheckRequestModel(); patch.ApplyTo(response); response.Name.Should().Be("A"); response.Timestamp.Should().BeEquivalentTo(BitConverter.GetBytes(1)); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiTimestampCheckResponseModel model = await client.TimestampCheckGetAsync(1); ApiTimestampCheckModelMapper mapper = new ApiTimestampCheckModelMapper(); UpdateResponse <ApiTimestampCheckResponseModel> updateResponse = await client.TimestampCheckUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }