public void MapResponseToRequest() { var mapper = new ApiSalesTerritoryModelMapper(); var model = new ApiSalesTerritoryResponseModel(); model.SetProperties(1, 1m, 1m, "A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), 1m, 1m); ApiSalesTerritoryRequestModel response = mapper.MapResponseToRequest(model); response.CostLastYear.Should().Be(1m); response.CostYTD.Should().Be(1m); response.CountryRegionCode.Should().Be("A"); [email protected]().Be("A"); 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.SalesLastYear.Should().Be(1m); response.SalesYTD.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()); ApiSalesTerritoryResponseModel model = await client.SalesTerritoryGetAsync(1); ApiSalesTerritoryModelMapper mapper = new ApiSalesTerritoryModelMapper(); UpdateResponse <ApiSalesTerritoryResponseModel> updateResponse = await client.SalesTerritoryUpdateAsync(model.TerritoryID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiSalesTerritoryModelMapper mapper = new ApiSalesTerritoryModelMapper(); UpdateResponse <ApiSalesTerritoryResponseModel> updateResponse = await this.Client.SalesTerritoryUpdateAsync(model.TerritoryID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }