示例#1
0
        public async Task CheckPasswordUserAsync()
        {
            var user            = new ApplicationUser();
            var contextAccessor = Substitute.For <IHttpContextAccessor>();
            var claimsFactory   = Substitute.For <IUserClaimsPrincipalFactory <ApplicationUser> >();
            var logger          = Substitute.For <ILogger <SignInManager <ApplicationUser> > >();
            var schemes         = Substitute.For <IAuthenticationSchemeProvider>();
            var confirmation    = Substitute.For <IUserConfirmation <ApplicationUser> >();
            var signInManager   = Substitute.For <SignInManager <ApplicationUser> >(_userManager, contextAccessor,
                                                                                    claimsFactory, _optionsAccessor, logger, schemes, confirmation);
            var loginValidator = new LoginValidator(signInManager, _userManager);

            signInManager.CheckPasswordSignInAsync(Arg.Any <ApplicationUser>(), Arg.Any <string>(), Arg.Any <bool>()).Returns(SignInResult.Success);
            await loginValidator.CheckPasswordUserAsync(user, "");

            await signInManager.Received().CheckPasswordSignInAsync(Arg.Any <ApplicationUser>(), Arg.Any <string>(), Arg.Any <bool>());
        }