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"); }
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"); }
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"); }