public void MapResponseToRequest() { var mapper = new ApiCurrencyRateModelMapper(); var model = new ApiCurrencyRateResponseModel(); model.SetProperties(1, 1m, DateTime.Parse("1/1/1987 12:00:00 AM"), 1m, "A", DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); ApiCurrencyRateRequestModel response = mapper.MapResponseToRequest(model); response.AverageRate.Should().Be(1m); response.CurrencyRateDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.EndOfDayRate.Should().Be(1m); response.FromCurrencyCode.Should().Be("A"); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.ToCurrencyCode.Should().Be("A"); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiCurrencyRateModelMapper mapper = new ApiCurrencyRateModelMapper(); UpdateResponse <ApiCurrencyRateResponseModel> updateResponse = await this.Client.CurrencyRateUpdateAsync(model.CurrencyRateID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiCurrencyRateResponseModel model = await client.CurrencyRateGetAsync(1); ApiCurrencyRateModelMapper mapper = new ApiCurrencyRateModelMapper(); UpdateResponse <ApiCurrencyRateResponseModel> updateResponse = await client.CurrencyRateUpdateAsync(model.CurrencyRateID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }