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 ApiPipelineServerModelMapper();
            ApplicationDbContext           context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;
            IPipelineService               service = testServer.Host.Services.GetService(typeof(IPipelineService)) as IPipelineService;
            ApiPipelineServerResponseModel model   = await service.Get(1);

            ApiPipelineClientRequestModel request = mapper.MapServerResponseToClientRequest(model);

            request.SetProperties(1, 2);

            UpdateResponse <ApiPipelineClientResponseModel> updateResponse = await client.PipelineUpdateAsync(model.Id, request);

            context.Entry(context.Set <Pipeline>().ToList()[0]).Reload();
            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
            updateResponse.Record.Id.Should().Be(1);
            context.Set <Pipeline>().ToList()[0].PipelineStatusId.Should().Be(1);
            context.Set <Pipeline>().ToList()[0].SaleId.Should().Be(2);

            updateResponse.Record.Id.Should().Be(1);
            updateResponse.Record.PipelineStatusId.Should().Be(1);
            updateResponse.Record.SaleId.Should().Be(2);
        }
        public virtual async void TestBulkInsert()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);
            var        client     = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());

            ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;

            var model = new ApiPipelineClientRequestModel();

            model.SetProperties(1, 2);
            var model2 = new ApiPipelineClientRequestModel();

            model2.SetProperties(1, 3);
            var request = new List <ApiPipelineClientRequestModel>()
            {
                model, model2
            };
            CreateResponse <List <ApiPipelineClientResponseModel> > result = await client.PipelineBulkInsertAsync(request);

            result.Success.Should().BeTrue();
            result.Record.Should().NotBeNull();

            context.Set <Pipeline>().ToList()[1].PipelineStatusId.Should().Be(1);
            context.Set <Pipeline>().ToList()[1].SaleId.Should().Be(2);

            context.Set <Pipeline>().ToList()[2].PipelineStatusId.Should().Be(1);
            context.Set <Pipeline>().ToList()[2].SaleId.Should().Be(3);
        }
        public virtual ApiPipelineClientRequestModel MapServerResponseToClientRequest(
            ApiPipelineServerResponseModel response)
        {
            var request = new ApiPipelineClientRequestModel();

            request.SetProperties(
                response.PipelineStatusId,
                response.SaleId);
            return(request);
        }
        public void MapClientRequestToResponse()
        {
            var mapper = new ApiPipelineModelMapper();
            var model  = new ApiPipelineClientRequestModel();

            model.SetProperties(1, 1);
            ApiPipelineClientResponseModel response = mapper.MapClientRequestToResponse(1, model);

            response.Should().NotBeNull();
            response.PipelineStatusId.Should().Be(1);
            response.SaleId.Should().Be(1);
        }