public async void TestUpdate() { var model = await this.CreateRecord(); ApiProductInventoryModelMapper mapper = new ApiProductInventoryModelMapper(); UpdateResponse <ApiProductInventoryResponseModel> updateResponse = await this.Client.ProductInventoryUpdateAsync(model.ProductID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiProductInventoryModelMapper(); var model = new ApiProductInventoryResponseModel(); model.SetProperties(1, 1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A"); ApiProductInventoryRequestModel response = mapper.MapResponseToRequest(model); response.Bin.Should().Be(1); response.LocationID.Should().Be(1); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Quantity.Should().Be(1); response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); response.Shelf.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiProductInventoryModelMapper(); var model = new ApiProductInventoryRequestModel(); model.SetProperties(1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A"); JsonPatchDocument <ApiProductInventoryRequestModel> patch = mapper.CreatePatch(model); var response = new ApiProductInventoryRequestModel(); patch.ApplyTo(response); response.Bin.Should().Be(1); response.LocationID.Should().Be(1); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Quantity.Should().Be(1); response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); response.Shelf.Should().Be("A"); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiProductInventoryResponseModel model = await client.ProductInventoryGetAsync(1); ApiProductInventoryModelMapper mapper = new ApiProductInventoryModelMapper(); UpdateResponse <ApiProductInventoryResponseModel> updateResponse = await client.ProductInventoryUpdateAsync(model.ProductID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }