public async void TestUpdate() { var model = await this.CreateRecord(); ApiProductListPriceHistoryModelMapper mapper = new ApiProductListPriceHistoryModelMapper(); UpdateResponse <ApiProductListPriceHistoryResponseModel> updateResponse = await this.Client.ProductListPriceHistoryUpdateAsync(model.ProductID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiProductListPriceHistoryModelMapper(); var model = new ApiProductListPriceHistoryResponseModel(); model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1m, DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM")); ApiProductListPriceHistoryRequestModel response = mapper.MapResponseToRequest(model); response.EndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.ListPrice.Should().Be(1m); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.StartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); }
public void CreatePatch() { var mapper = new ApiProductListPriceHistoryModelMapper(); var model = new ApiProductListPriceHistoryRequestModel(); model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), 1m, DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM")); JsonPatchDocument <ApiProductListPriceHistoryRequestModel> patch = mapper.CreatePatch(model); var response = new ApiProductListPriceHistoryRequestModel(); patch.ApplyTo(response); response.EndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.ListPrice.Should().Be(1m); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.StartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiProductListPriceHistoryResponseModel model = await client.ProductListPriceHistoryGetAsync(1); ApiProductListPriceHistoryModelMapper mapper = new ApiProductListPriceHistoryModelMapper(); UpdateResponse <ApiProductListPriceHistoryResponseModel> updateResponse = await client.ProductListPriceHistoryUpdateAsync(model.ProductID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }