public void Logout_WithNoLoggedInUser_ShouldThrowACorrectException()
        {
            var database = new Mock<IBangaloreUniversityData>();

            var userController = new UsersController(database.Object, null);

            var exception = NUnit.Framework.Assert.Catch<ArgumentException>(() => { userController.Logout(); });

            Assert.AreEqual("There is no currently logged in user.", exception.Message);
        }
        public void Logout_NoUserLogged_ReturnsCorrectResult()
        {
            var userController = new UsersController(
                new BangaloreUniversityData(),
                new User("Pesho", "123456", Role.Lecturer));

            var result = userController.Logout();

            Assert.IsInstanceOfType(result, typeof(IView));
        }
        public void Logout_NoUserLogged_NoUser()
        {
            var userController = new UsersController(
                new BangaloreUniversityData(),
                new User("Pesho", "123456", Role.Lecturer));

            userController.Logout();

            Assert.AreEqual(null, userController.CurrentUser);
        }
        public void Logout_NoUserLogged_ReturnsCorrectResultMock()
        {
            var user = new Mock<User>("Pesho", "123456", Role.Lecturer);
            var database = new Mock<IBangaloreUniversityData>();

            var userController = new UsersController(database.Object, user.Object);

            var result = userController.Logout();

            Assert.IsInstanceOfType(result, typeof(IView));
        }
        public void Logout_WithValidInput_ShouldLogOutUser()
        {
            var user = new Mock<User>("Ivan Ivanov", "123456", Role.Student);

            var database = new Mock<IBangaloreUniversityData>();

            var userController = new UsersController(database.Object, user.Object);

            Assert.AreEqual(user.Object, userController.CurrentUser);

            userController.Logout();

            Assert.AreEqual(null, userController.CurrentUser);
        }
        public void Logout_NoUserLogged_TrowsArgumentException()
        {
            var userController = new UsersController(new BangaloreUniversityData(), null);

            userController.Logout();
        }