Exemplo n.º 1
0
        public void SocialSignIn_CreateAsyncFailed_SocialSignInFailedException()
        {
            var userManager           = new FakeUserManager();
            var signInManager         = new FakeSignInManager();
            var authValidationService = new Mock <IAuthValidationService>().Object;
            var configuration         = new Mock <IConfiguration>().Object;
            var dataService           = new Mock <IDataService>().Object;

            var authService = new AuthService(userManager, signInManager, authValidationService,
                                              configuration, dataService);

            var model = new SocialSignInViewModel
            {
                UserName  = "******",
                Email     = "email",
                FirstName = "firstName",
                LastName  = "lastName"
            };

            //Act
            Func <Task> result = async() =>
            {
                await authService.SocialSignIn(model);
            };

            result.Should().Throw <SocialSignInFailedException>();
        }
Exemplo n.º 2
0
        public void SignIn_CreateAsyncFailed_ReturnsSignInFailedException()
        {
            var userManager           = new FakeUserManager();
            var signInManager         = new FakeSignInManager();
            var authValidationService = new Mock <IAuthValidationService>().Object;
            var configuration         = new Mock <IConfiguration>().Object;
            var dataService           = new Mock <IDataService>().Object;

            var authService = new AuthService(userManager, signInManager, authValidationService,
                                              configuration, dataService);

            var model = new SignInViewModel
            {
                UserName = "******",
                Password = "******"
            };

            //Act
            Func <Task> result = async() =>
            {
                await authService.SignIn(model);
            };

            result.Should().Throw <SignInFailedException>();
        }