Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 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);
 }