private SesshinsController GetSesshinsController(MockSesshinService mockSesshin) { var authService = MockAuthorizationService.BuildAuthorizationService(services => { services.AddScoped <ISesshinService>(sp => mockSesshin.Object); services.AddScoped <IAuthorizationHandler, AdminAuthorizationHandler>(); }); var controller = new SesshinsController(mockSesshin.Object, authService); MockAuthorizationService.SetupUserWithRole(controller, Constants.UserAdministratorsRole); return(controller); }
public SesshinControllerTest() { _testSesshin = new Sesshin { Id = _testSesshinId, Name = "Winter sesshin", Description = "Night sesshin in Yujio Nyusanji", StartDate = new DateTime(2019, 12, 27), EndDate = new DateTime(2020, 01, 01), AppUserId = "userId" }; _mockService = new MockSesshinService(); _controller = GetSesshinsController(_mockService); }