Пример #1
0
        public virtual async void TestDelete()
        {
            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;

            IPipelineStepStatusService service = testServer.Host.Services.GetService(typeof(IPipelineStepStatusService)) as IPipelineStepStatusService;
            var model = new ApiPipelineStepStatusServerRequestModel();

            model.SetProperties("B");
            CreateResponse <ApiPipelineStepStatusServerResponseModel> createdResponse = await service.Create(model);

            createdResponse.Success.Should().BeTrue();

            ActionResponse deleteResult = await client.PipelineStepStatusDeleteAsync(2);

            deleteResult.Success.Should().BeTrue();
            ApiPipelineStepStatusServerResponseModel verifyResponse = await service.Get(2);

            verifyResponse.Should().BeNull();
        }
Пример #2
0
        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 ApiPipelineStepStatusServerModelMapper();
            ApplicationDbContext       context             = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;
            IPipelineStepStatusService service             = testServer.Host.Services.GetService(typeof(IPipelineStepStatusService)) as IPipelineStepStatusService;
            ApiPipelineStepStatusServerResponseModel model = await service.Get(1);

            ApiPipelineStepStatusClientRequestModel request = mapper.MapServerResponseToClientRequest(model);

            request.SetProperties("B");

            UpdateResponse <ApiPipelineStepStatusClientResponseModel> updateResponse = await client.PipelineStepStatusUpdateAsync(model.Id, request);

            context.Entry(context.Set <PipelineStepStatus>().ToList()[0]).Reload();
            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
            updateResponse.Record.Id.Should().Be(1);
            context.Set <PipelineStepStatus>().ToList()[0].Name.Should().Be("B");

            updateResponse.Record.Id.Should().Be(1);
            updateResponse.Record.Name.Should().Be("B");
        }
 public AbstractPipelineStepStatusController(
     ApiSettings settings,
     ILogger <AbstractPipelineStepStatusController> logger,
     ITransactionCoordinator transactionCoordinator,
     IPipelineStepStatusService pipelineStepStatusService,
     IApiPipelineStepStatusModelMapper pipelineStepStatusModelMapper
     )
     : base(settings, logger, transactionCoordinator)
 {
     this.PipelineStepStatusService     = pipelineStepStatusService;
     this.PipelineStepStatusModelMapper = pipelineStepStatusModelMapper;
 }
Пример #4
0
 public PipelineStepStatusController(
     ApiSettings settings,
     ILogger <PipelineStepStatusController> logger,
     ITransactionCoordinator transactionCoordinator,
     IPipelineStepStatusService pipelineStepStatusService,
     IApiPipelineStepStatusServerModelMapper pipelineStepStatusModelMapper
     )
     : base(settings, logger, transactionCoordinator)
 {
     this.PipelineStepStatusService     = pipelineStepStatusService;
     this.PipelineStepStatusModelMapper = pipelineStepStatusModelMapper;
     this.BulkInsertLimit = 250;
     this.MaxLimit        = 1000;
     this.DefaultLimit    = 250;
 }