public void MapResponseToRequest() { var mapper = new ApiCurrencyModelMapper(); var model = new ApiCurrencyResponseModel(); model.SetProperties("A", DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); ApiCurrencyRequestModel response = mapper.MapResponseToRequest(model); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.Should().Be("A"); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiCurrencyModelMapper mapper = new ApiCurrencyModelMapper(); UpdateResponse <ApiCurrencyResponseModel> updateResponse = await this.Client.CurrencyUpdateAsync(model.CurrencyCode, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void CreatePatch() { var mapper = new ApiCurrencyModelMapper(); var model = new ApiCurrencyRequestModel(); model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); JsonPatchDocument <ApiCurrencyRequestModel> patch = mapper.CreatePatch(model); var response = new ApiCurrencyRequestModel(); patch.ApplyTo(response); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.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()); ApiCurrencyResponseModel model = await client.CurrencyGetAsync("A"); ApiCurrencyModelMapper mapper = new ApiCurrencyModelMapper(); UpdateResponse <ApiCurrencyResponseModel> updateResponse = await client.CurrencyUpdateAsync(model.CurrencyCode, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }