Ejemplo n.º 1
0
        public async Task OnPostLoginAsync_ValidCredentials_ReturnsLocalRedirectResult()
        {
            var model = await SetupModelAsync();

            await _context.UserManager.SeedTestUserAsync();

            var input = new RegisterModel.LoginInputModel()
            {
                Email      = SeedTestData.Email,
                Password   = SeedTestData.Password,
                RememberMe = false
            };

            var result = await model.OnPostLoginAsync(input);

            Assert.IsType <LocalRedirectResult>(result);
        }
Ejemplo n.º 2
0
        public async Task OnPostLoginAsync_InvalidCredentials_ReturnsPage(string email, string password)
        {
            var model = await SetupModelAsync();

            var input = new RegisterModel.LoginInputModel()
            {
                Email      = email,
                Password   = password,
                RememberMe = false
            };

            model.ValidateToModelState(input);

            var result = await model.OnPostLoginAsync(input);

            Assert.IsType <PageResult>(result);
        }