Ejemplo n.º 1
0
 private static bool Authenticate(AuthCmdArgs args, ILogger logger)
 {
     using (var handler = new WindowsSecurityHandler(logger, TimeSpan.FromSeconds(args.Timeout)))
     {
         handler.Handle(args.Username, args.Password);
         return(handler.IsHandled);
     }
 }
Ejemplo n.º 2
0
        public void Authenticate()
        {
            const string username = "******";
            const string password = "******";

            _dialog.EnterCredentials(Arg.Is(username), Arg.Is(password)).Returns(true);
            _dialog.Submit().Returns(true);

            _handler.Handle(username, password);

            Assert.That(_handler.IsHandled);
            // Calls: Authenticate, Dialog.EnterCredentials, Dialog.Submit.
            _logger.Received(3).LogExec(Arg.Any <Expression <Func <bool> > >());
            _dialog.Received(1).EnterCredentials(username, password);
            _dialog.Received(1).Submit();
            // No info messages.
            _logger.DidNotReceive().LogInfo(Arg.Any <string>());
        }