public async void TestUpdate() { var model = await this.CreateRecord(); ApiShipMethodModelMapper mapper = new ApiShipMethodModelMapper(); UpdateResponse <ApiShipMethodResponseModel> updateResponse = await this.Client.ShipMethodUpdateAsync(model.ShipMethodID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiShipMethodModelMapper(); var model = new ApiShipMethodResponseModel(); model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), 1m, 1m); ApiShipMethodRequestModel response = mapper.MapResponseToRequest(model); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.Should().Be("A"); response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); response.ShipBase.Should().Be(1m); response.ShipRate.Should().Be(1m); }
public void CreatePatch() { var mapper = new ApiShipMethodModelMapper(); var model = new ApiShipMethodRequestModel(); model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), 1m, 1m); JsonPatchDocument<ApiShipMethodRequestModel> patch = mapper.CreatePatch(model); var response = new ApiShipMethodRequestModel(); patch.ApplyTo(response); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.Should().Be("A"); response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); response.ShipBase.Should().Be(1m); response.ShipRate.Should().Be(1m); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiShipMethodResponseModel model = await client.ShipMethodGetAsync(1); ApiShipMethodModelMapper mapper = new ApiShipMethodModelMapper(); UpdateResponse <ApiShipMethodResponseModel> updateResponse = await client.ShipMethodUpdateAsync(model.ShipMethodID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }