public void MapServerResponseToRequest()
        {
            var mapper = new ApiCustomerServerModelMapper();
            var model  = new ApiCustomerServerResponseModel();

            model.SetProperties(1, "A", "A", "A", "A");
            ApiCustomerServerRequestModel response = mapper.MapServerResponseToRequest(model);

            response.Should().NotBeNull();
            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.LastName.Should().Be("A");
            response.Phone.Should().Be("A");
        }
        public void CreatePatch()
        {
            var mapper = new ApiCustomerServerModelMapper();
            var model  = new ApiCustomerServerRequestModel();

            model.SetProperties("A", "A", "A", "A");

            JsonPatchDocument <ApiCustomerServerRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiCustomerServerRequestModel();

            patch.ApplyTo(response);
            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.LastName.Should().Be("A");
            response.Phone.Should().Be("A");
        }
        public virtual async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            var mapper = new ApiCustomerServerModelMapper();
            ApplicationDbContext           context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;
            ICustomerService               service = testServer.Host.Services.GetService(typeof(ICustomerService)) as ICustomerService;
            ApiCustomerServerResponseModel model   = await service.Get(1);

            ApiCustomerClientRequestModel request = mapper.MapServerResponseToClientRequest(model);

            request.SetProperties("B", "B", "B", "B", "B");

            UpdateResponse <ApiCustomerClientResponseModel> updateResponse = await client.CustomerUpdateAsync(model.Id, request);

            context.Entry(context.Set <Customer>().ToList()[0]).Reload();
            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
            updateResponse.Record.Id.Should().Be(1);
            context.Set <Customer>().ToList()[0].Email.Should().Be("B");
            context.Set <Customer>().ToList()[0].FirstName.Should().Be("B");
            context.Set <Customer>().ToList()[0].LastName.Should().Be("B");
            context.Set <Customer>().ToList()[0].Notes.Should().Be("B");
            context.Set <Customer>().ToList()[0].Phone.Should().Be("B");

            updateResponse.Record.Id.Should().Be(1);
            updateResponse.Record.Email.Should().Be("B");
            updateResponse.Record.FirstName.Should().Be("B");
            updateResponse.Record.LastName.Should().Be("B");
            updateResponse.Record.Notes.Should().Be("B");
            updateResponse.Record.Phone.Should().Be("B");
        }