public async Task<ActionResult> Register(RegisterViewModel register)
        {
            // call Service
            IRegisterService registerService = new RegisterService();

            var datetime = DateTime.UtcNow;

            TempData["password"] = registerService.GeneratePassword(register.UserId, datetime);

            return RedirectToAction("Login");
        }
        public void GetTimeFromPassword_PosiviteTest()
        {
            // arrange
            var expectedDateTime = new DateTime(2015, 6, 21, 9, 10, 10);
            const string password = "******";
            RegisterService registerService = new RegisterService();

            // act
            var dateTime = registerService.GetTimeFromPassword(password);

            // assert
            Assert.AreEqual(expectedDateTime, dateTime);
        }
        public async Task<ActionResult> Login(LoginViewModel login)
        {
			IRegisterService registerService = new RegisterService();

            DateTime time = registerService.GetTimeFromPassword(login.Password);
			
			if (time > DateTime.UtcNow.AddSeconds(-30)) 
			{
                TempData["username"] = login.UserId;
                return RedirectToAction("Welcome");
			}
			
			return RedirectToAction("Register");
        }
        public void GeneratePassword_PositiveTest()
        {
            // arrange
            const string userId = "user1";
            const string expectedPassword = "******";
            var dateTime = new DateTime(2015, 6, 21, 9, 10, 10);
            RegisterService registerService = new RegisterService();

            // act
            var password = registerService.GeneratePassword(userId, dateTime);

            // assert
            Assert.AreEqual(expectedPassword, password);
        }