public void MapResponseToRequest() { var mapper = new ApiProductDescriptionModelMapper(); var model = new ApiProductDescriptionResponseModel(); model.SetProperties(1, "A", DateTime.Parse("1/1/1987 12:00:00 AM"), Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); ApiProductDescriptionRequestModel response = mapper.MapResponseToRequest(model); response.Description.Should().Be("A"); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiProductDescriptionModelMapper mapper = new ApiProductDescriptionModelMapper(); UpdateResponse <ApiProductDescriptionResponseModel> updateResponse = await this.Client.ProductDescriptionUpdateAsync(model.ProductDescriptionID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void CreatePatch() { var mapper = new ApiProductDescriptionModelMapper(); var model = new ApiProductDescriptionRequestModel(); model.SetProperties("A", DateTime.Parse("1/1/1987 12:00:00 AM"), Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); JsonPatchDocument <ApiProductDescriptionRequestModel> patch = mapper.CreatePatch(model); var response = new ApiProductDescriptionRequestModel(); patch.ApplyTo(response); response.Description.Should().Be("A"); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Rowguid.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()); ApiProductDescriptionResponseModel model = await client.ProductDescriptionGetAsync(1); ApiProductDescriptionModelMapper mapper = new ApiProductDescriptionModelMapper(); UpdateResponse <ApiProductDescriptionResponseModel> updateResponse = await client.ProductDescriptionUpdateAsync(model.ProductDescriptionID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }