コード例 #1
0
        public static void SetupAuthenticationService(this InteractionContext <LoginController> context, bool authenticates = true)
        {
            var strategies = context.Services.CreateMockArrayFor <IAuthenticationStrategy>(1);

            strategies[0].Stub(x => x.Authenticate(Arg <LoginRequest> .Is.Anything)).Return(authenticates);
            var authService = new AuthenticationService(
                context.MockFor <ILogger>(),
                strategies,
                context.MockFor <ILoginAuditor>(),
                context.MockFor <ILoginCookies>());

            context.Services.Inject(authService as IAuthenticationService);
        }