Esempio n. 1
0
        public async Task UserSuccessfulLogin()
        {
            var context = new POAMDbContext();

            var ownerController = new OwnerController(context);

            var result = await ownerController.Login(CreateUser(context));

            var redirectResult = Assert.IsType <ViewResult>(result);

            Assert.NotNull(redirectResult);
            Assert.True(string.IsNullOrEmpty(redirectResult.ViewName) || redirectResult.ViewName == "MainPage");
        }
Esempio n. 2
0
        public async Task LoginUsernameNotExisting()
        {
            var context = new POAMDbContext();

            var ownerController = new OwnerController(context);

            var user = CreateUser(context);

            user.Username = "******";
            var result = await ownerController.Login(user);

            var redirectResult = Assert.IsType <ViewResult>(result);

            Assert.NotNull(redirectResult);
            Assert.True(string.IsNullOrEmpty(redirectResult.ViewName) || redirectResult.ViewName == "Login");
        }
Esempio n. 3
0
        public async Task LoginWrongPassword()
        {
            var context = new POAMDbContext();

            var ownerController = new OwnerController(context);

            var user = CreateUser(context);

            user.Password = "******";

            var result = await ownerController.Login(user);

            var redirectResult = Assert.IsType <ViewResult>(result);

            Assert.NotNull(redirectResult);
            Assert.True(string.IsNullOrEmpty(redirectResult.ViewName) || redirectResult.ViewName == "Login");
        }