public void MapResponseToRequest()
        {
            var mapper = new ApiPipelineModelMapper();
            var model  = new ApiPipelineResponseModel();

            model.SetProperties(1, 1, 1);
            ApiPipelineRequestModel response = mapper.MapResponseToRequest(model);

            response.PipelineStatusId.Should().Be(1);
            response.SaleId.Should().Be(1);
        }
        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);
        }
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiPipelineModelMapper mapper = new ApiPipelineModelMapper();

            UpdateResponse <ApiPipelineResponseModel> updateResponse = await this.Client.PipelineUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

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

            await this.Cleanup();
        }
        public void CreatePatch()
        {
            var mapper = new ApiPipelineModelMapper();
            var model  = new ApiPipelineRequestModel();

            model.SetProperties(1, 1);

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

            patch.ApplyTo(response);
            response.PipelineStatusId.Should().Be(1);
            response.SaleId.Should().Be(1);
        }
Exemple #5
0
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            ApiPipelineResponseModel model = await client.PipelineGetAsync(1);

            ApiPipelineModelMapper mapper = new ApiPipelineModelMapper();

            UpdateResponse <ApiPipelineResponseModel> updateResponse = await client.PipelineUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
        }