Beispiel #1
0
        public async Task GetUserById()
        {
            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);

            await loginValidator.GetUserById("admin");

            await _userManager.Received().FindByNameAsync(Arg.Any <string>());
        }