public EventStatusApiController(IEventStatusService service , ILogger <EventStatusApiController> logger , IAuthenticationService <int> authService) : base(logger) { _service = service; _authService = authService; }
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 ApiEventStatusServerModelMapper(); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; IEventStatusService service = testServer.Host.Services.GetService(typeof(IEventStatusService)) as IEventStatusService; ApiEventStatusServerResponseModel model = await service.Get(1); ApiEventStatusClientRequestModel request = mapper.MapServerResponseToClientRequest(model); request.SetProperties("B"); UpdateResponse <ApiEventStatusClientResponseModel> updateResponse = await client.EventStatusUpdateAsync(model.Id, request); context.Entry(context.Set <EventStatus>().ToList()[0]).Reload(); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); updateResponse.Record.Id.Should().Be(1); context.Set <EventStatus>().ToList()[0].Name.Should().Be("B"); updateResponse.Record.Id.Should().Be(1); updateResponse.Record.Name.Should().Be("B"); }
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; IEventStatusService service = testServer.Host.Services.GetService(typeof(IEventStatusService)) as IEventStatusService; var model = new ApiEventStatusServerRequestModel(); model.SetProperties("B"); CreateResponse <ApiEventStatusServerResponseModel> createdResponse = await service.Create(model); createdResponse.Success.Should().BeTrue(); ActionResponse deleteResult = await client.EventStatusDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiEventStatusServerResponseModel verifyResponse = await service.Get(2); verifyResponse.Should().BeNull(); }
public AbstractEventStatusController( ApiSettings settings, ILogger <AbstractEventStatusController> logger, ITransactionCoordinator transactionCoordinator, IEventStatusService eventStatusService, IApiEventStatusModelMapper eventStatusModelMapper ) : base(settings, logger, transactionCoordinator) { this.EventStatusService = eventStatusService; this.EventStatusModelMapper = eventStatusModelMapper; }
public EventHandlerService( IEventStatusService statusService, IHttpService httpService, ITilgangerService tilgangerService, IOptions <AppSettings> appSettings, ILogger <EventHandlerService> logger) { _statusService = statusService; _httpService = httpService; _tilgangerService = tilgangerService; _logger = logger; _appSettings = appSettings.Value; }
public EventStatusController( ApiSettings settings, ILogger <EventStatusController> logger, ITransactionCoordinator transactionCoordinator, IEventStatusService eventStatusService, IApiEventStatusServerModelMapper eventStatusModelMapper ) : base(settings, logger, transactionCoordinator) { this.EventStatusService = eventStatusService; this.EventStatusModelMapper = eventStatusModelMapper; this.BulkInsertLimit = 250; this.MaxLimit = 1000; this.DefaultLimit = 250; }
public EventStatusController(IEventStatusService service) { this._service = service; }