public void Registration_RegisterUserWithAnEmailAlreadyUsed_StatusFalse()
        {
            IList <User> users = new List <User>()
            {
                new User("", "*****@*****.**", "")
            };

            Mock <IUserRepository> MockUserRepository = new Mock <IUserRepository>();

            UserRepositorySetupMoq.Add(MockUserRepository, users);
            UserRepositorySetupMoq.FindByEmail(MockUserRepository, users);
            IUserRepository userRepository = MockUserRepository.Object;

            IUserService userService = new UserService(userRepository);

            var controller = new UserController(userService);

            Mock <IRegistrationViewModel> MockRegistrationViewModel = new Mock <IRegistrationViewModel>();
            MailMessage message = new MailMessage();

            UserControllerSetupMoq.CheckUser(MockRegistrationViewModel);
            IRegistrationViewModel registrationViewModel = MockRegistrationViewModel.Object;

            //Act
            User dummyUser = new User("", "*****@*****.**", "");
            bool result    = registrationViewModel.CheckUser(userService, dummyUser);

            //Assert
            Assert.IsFalse(result);
        }
        public void Registration_RegisterUserWithValidData_StatusTrue()
        {
            //Arrange
            IList <User> users = new List <User>()
            {
                new User("", "*****@*****.**", "")
            };

            Mock <IUserRepository> MockUserRepository = new Mock <IUserRepository>();

            UserRepositorySetupMoq.Add(MockUserRepository, users);
            UserRepositorySetupMoq.FindByEmail(MockUserRepository, users);
            IUserRepository userRepository = MockUserRepository.Object;
            IUserService    userService    = new UserService(userRepository);

            var controller = new UserController(userService);

            Mock <IRegistrationViewModel> MockRegistrationViewModel = new Mock <IRegistrationViewModel>();
            MailMessage message = new MailMessage();

            UserControllerSetupMoq.CheckUser(MockRegistrationViewModel);
            IRegistrationViewModel registrationViewModel = MockRegistrationViewModel.Object;

            //Act
            var  dummyUser = new User("Andrew", "*****@*****.**", "");
            bool result    = registrationViewModel.CheckUser(userService, dummyUser);


            //Assert
            Assert.IsTrue(result);
        }
        public void Login_LoginUserWithValidData_StatusTrue()
        {
            //Arrange
            IList <User> users = new List <User>()
            {
                new User("", "*****@*****.**", "test")
            };

            Mock <IUserRepository> MockUserRepository = new Mock <IUserRepository>();

            UserRepositorySetupMoq.Add(MockUserRepository, users);
            UserRepositorySetupMoq.FindByEmail(MockUserRepository, users);
            IUserRepository userRepository = MockUserRepository.Object;

            IUserService userService = new UserService(userRepository);

            Mock <IRegistrationViewModel> MockRegistrationViewModel = new Mock <IRegistrationViewModel>();
            MailMessage message = new MailMessage();

            UserControllerSetupMoq.CheckUser(MockRegistrationViewModel);

            Mock <ILogInViewModel> MockLogInViewModel = new Mock <ILogInViewModel>();

            UserControllerSetupMoq.CheckUser(MockLogInViewModel);
            ILogInViewModel loginViewModel = MockLogInViewModel.Object;
            //Act
            User dummyUser = new User("", "*****@*****.**", "test");
            bool result    = loginViewModel.CheckUser(userService, dummyUser);

            //Assert
            Assert.IsTrue(result);
        }
        public void Login_LoginUserWithAnInvalidEmail_StatusFalse()
        {
            Mock <IUserRepository> MockUserRepository = new Mock <IUserRepository>();
            IUserRepository        userRepository     = MockUserRepository.Object;
            IUserService           userService        = new UserService(userRepository);
            Mock <ILogInViewModel> MockLogInViewModel = new Mock <ILogInViewModel>();

            UserControllerSetupMoq.CheckUser(MockLogInViewModel);
            ILogInViewModel loginViewModel = MockLogInViewModel.Object;
            //Act
            User dummyUser = new User("", "*****@*****.**", "");
            bool result    = loginViewModel.CheckUser(userService, dummyUser);

            //Assert
            Assert.IsFalse(result);
        }