Exemplo n.º 1
0
        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");
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        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();
        }