public void MapResponseToRequest() { var mapper = new ApiProductCostHistoryModelMapper(); var model = new ApiProductCostHistoryResponseModel(); model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), 1m, DateTime.Parse("1/1/1987 12:00:00 AM")); ApiProductCostHistoryRequestModel response = mapper.MapResponseToRequest(model); response.EndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.StandardCost.Should().Be(1m); response.StartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiProductCostHistoryModelMapper mapper = new ApiProductCostHistoryModelMapper(); UpdateResponse <ApiProductCostHistoryResponseModel> updateResponse = await this.Client.ProductCostHistoryUpdateAsync(model.ProductID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void CreatePatch() { var mapper = new ApiProductCostHistoryModelMapper(); var model = new ApiProductCostHistoryRequestModel(); model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), 1m, DateTime.Parse("1/1/1987 12:00:00 AM")); JsonPatchDocument <ApiProductCostHistoryRequestModel> patch = mapper.CreatePatch(model); var response = new ApiProductCostHistoryRequestModel(); patch.ApplyTo(response); response.EndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.StandardCost.Should().Be(1m); 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()); ApiProductCostHistoryResponseModel model = await client.ProductCostHistoryGetAsync(1); ApiProductCostHistoryModelMapper mapper = new ApiProductCostHistoryModelMapper(); UpdateResponse <ApiProductCostHistoryResponseModel> updateResponse = await client.ProductCostHistoryUpdateAsync(model.ProductID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }