public void MapClientResponseToRequest() { var mapper = new ApiSaleModelMapper(); var model = new ApiSaleClientResponseModel(); model.SetProperties(1, 1, DateTime.Parse("1/1/1987 12:00:00 AM")); ApiSaleClientRequestModel response = mapper.MapClientResponseToRequest(model); response.Should().NotBeNull(); response.CustomerId.Should().Be(1); response.Date.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiSaleModelMapper mapper = new ApiSaleModelMapper(); UpdateResponse <ApiSaleResponseModel> updateResponse = await this.Client.SaleUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiSaleModelMapper(); var model = new ApiSaleResponseModel(); model.SetProperties(1, "A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1); ApiSaleRequestModel response = mapper.MapResponseToRequest(model); response.IpAddress.Should().Be("A"); response.Note.Should().Be("A"); response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.TransactionId.Should().Be(1); }
public void MapResponseToRequest() { var mapper = new ApiSaleModelMapper(); var model = new ApiSaleResponseModel(); model.SetProperties(1, 1m, 1, "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1); ApiSaleRequestModel response = mapper.MapResponseToRequest(model); response.Amount.Should().Be(1m); response.ClientId.Should().Be(1); response.Note.Should().Be("A"); response.PetId.Should().Be(1); response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.SalesPersonId.Should().Be(1); }
public void MapResponseToRequest() { var mapper = new ApiSaleModelMapper(); var model = new ApiSaleResponseModel(); model.SetProperties(1, 1m, "A", "A", 1, 1, "A"); ApiSaleRequestModel response = mapper.MapResponseToRequest(model); response.Amount.Should().Be(1m); response.FirstName.Should().Be("A"); response.LastName.Should().Be("A"); response.PaymentTypeId.Should().Be(1); response.PetId.Should().Be(1); response.Phone.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiSaleModelMapper(); var model = new ApiSaleRequestModel(); model.SetProperties("A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1); JsonPatchDocument <ApiSaleRequestModel> patch = mapper.CreatePatch(model); var response = new ApiSaleRequestModel(); patch.ApplyTo(response); response.IpAddress.Should().Be("A"); response.Note.Should().Be("A"); response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.TransactionId.Should().Be(1); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiSaleResponseModel model = await client.SaleGetAsync(1); ApiSaleModelMapper mapper = new ApiSaleModelMapper(); UpdateResponse <ApiSaleResponseModel> updateResponse = await client.SaleUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }
public void CreatePatch() { var mapper = new ApiSaleModelMapper(); var model = new ApiSaleRequestModel(); model.SetProperties(1m, 1, "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1); JsonPatchDocument <ApiSaleRequestModel> patch = mapper.CreatePatch(model); var response = new ApiSaleRequestModel(); patch.ApplyTo(response); response.Amount.Should().Be(1m); response.ClientId.Should().Be(1); response.Note.Should().Be("A"); response.PetId.Should().Be(1); response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.SalesPersonId.Should().Be(1); }
public void CreatePatch() { var mapper = new ApiSaleModelMapper(); var model = new ApiSaleRequestModel(); model.SetProperties(1m, "A", "A", 1, 1, "A"); JsonPatchDocument <ApiSaleRequestModel> patch = mapper.CreatePatch(model); var response = new ApiSaleRequestModel(); patch.ApplyTo(response); response.Amount.Should().Be(1m); response.FirstName.Should().Be("A"); response.LastName.Should().Be("A"); response.PaymentTypeId.Should().Be(1); response.PetId.Should().Be(1); response.Phone.Should().Be("A"); }