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; IPipelineStepNoteService service = testServer.Host.Services.GetService(typeof(IPipelineStepNoteService)) as IPipelineStepNoteService; var model = new ApiPipelineStepNoteServerRequestModel(); model.SetProperties(1, "B", 1); CreateResponse <ApiPipelineStepNoteServerResponseModel> createdResponse = await service.Create(model); createdResponse.Success.Should().BeTrue(); ActionResponse deleteResult = await client.PipelineStepNoteDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiPipelineStepNoteServerResponseModel verifyResponse = await service.Get(2); verifyResponse.Should().BeNull(); }
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 ApiPipelineStepNoteServerModelMapper(); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; IPipelineStepNoteService service = testServer.Host.Services.GetService(typeof(IPipelineStepNoteService)) as IPipelineStepNoteService; ApiPipelineStepNoteServerResponseModel model = await service.Get(1); ApiPipelineStepNoteClientRequestModel request = mapper.MapServerResponseToClientRequest(model); request.SetProperties(1, "B", 1); UpdateResponse <ApiPipelineStepNoteClientResponseModel> updateResponse = await client.PipelineStepNoteUpdateAsync(model.Id, request); context.Entry(context.Set <PipelineStepNote>().ToList()[0]).Reload(); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); updateResponse.Record.Id.Should().Be(1); context.Set <PipelineStepNote>().ToList()[0].EmployeeId.Should().Be(1); context.Set <PipelineStepNote>().ToList()[0].Note.Should().Be("B"); context.Set <PipelineStepNote>().ToList()[0].PipelineStepId.Should().Be(1); updateResponse.Record.Id.Should().Be(1); updateResponse.Record.EmployeeId.Should().Be(1); updateResponse.Record.Note.Should().Be("B"); updateResponse.Record.PipelineStepId.Should().Be(1); }
public AbstractPipelineStepNoteController( ApiSettings settings, ILogger <AbstractPipelineStepNoteController> logger, ITransactionCoordinator transactionCoordinator, IPipelineStepNoteService pipelineStepNoteService, IApiPipelineStepNoteModelMapper pipelineStepNoteModelMapper ) : base(settings, logger, transactionCoordinator) { this.PipelineStepNoteService = pipelineStepNoteService; this.PipelineStepNoteModelMapper = pipelineStepNoteModelMapper; }
public PipelineStepNoteController( ApiSettings settings, ILogger <PipelineStepNoteController> logger, ITransactionCoordinator transactionCoordinator, IPipelineStepNoteService pipelineStepNoteService, IApiPipelineStepNoteServerModelMapper pipelineStepNoteModelMapper ) : base(settings, logger, transactionCoordinator) { this.PipelineStepNoteService = pipelineStepNoteService; this.PipelineStepNoteModelMapper = pipelineStepNoteModelMapper; this.BulkInsertLimit = 250; this.MaxLimit = 1000; this.DefaultLimit = 250; }