/// <summary> /// Initializes a new instance of the <see cref="PermissionsController"/> class. /// </summary> /// <param name="authenticationService">The default authentication service.</param> /// <param name="resourceSetRepository">The resource set repository.</param> /// <param name="ticketStore">The ticket store.</param> /// <param name="options">The options.</param> /// <param name="eventPublisher">The event publisher.</param> /// <param name="tokenStore">The token store.</param> /// <param name="logger">The logger</param> public PermissionsController( IAuthenticationService authenticationService, IResourceSetRepository resourceSetRepository, ITicketStore ticketStore, RuntimeSettings options, IEventPublisher eventPublisher, ITokenStore tokenStore, ILogger <PermissionsController> logger) : base(authenticationService) { _ticketStore = ticketStore; _eventPublisher = eventPublisher; _logger = logger; _resourceSetRepository = resourceSetRepository; _requestPermission = new RequestPermissionHandler(tokenStore, resourceSetRepository, options, logger); }
private void InitializeFakeObjects(params ResourceSet[] resourceSets) { _resourceSetRepositoryStub = new Mock <IResourceSetRepository>(); _resourceSetRepositoryStub .Setup(x => x.Get(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>())) .Returns <string, string, CancellationToken>( (o, s, c) => Task.FromResult(resourceSets.FirstOrDefault(x => x.Id == s))); _resourceSetRepositoryStub.Setup(x => x.Get(It.IsAny <CancellationToken>(), It.IsAny <string[]>())) .ReturnsAsync(resourceSets); _ticketStoreStub = new Mock <ITicketStore>(); _configurationServiceStub = new RuntimeSettings(ticketLifeTime: TimeSpan.FromSeconds(2)); _requestPermissionHandler = new RequestPermissionHandler( new InMemoryTokenStore(), _resourceSetRepositoryStub.Object, _configurationServiceStub, new TestOutputLogger("test", _outputHelper)); }