public void TestCreateJourneyForAnExistingUser()
        {
            IUserRepository userRepository = UserRepository.Instance;
            UserRegistration.UserRegistrationService service = new UserRegistrationService(userRepository);
            User traveller = new User(new Email("*****@*****.**"), new UserName("Test", "User"), "12345", null);

            service.CreateUser(traveller);

            Location origin = new Location("London", new TravelDate(DateTime.Now));
            Location destination = new Location("Mumbai", new TravelDate(DateTime.Now));
            Journey journey = new Journey(traveller, origin, destination);

            IJourneyRepository journeyRepository = JourneyRepository.Instance;
            journeyRepository.Save(journey);

            IList<Journey> journeyList = journeyRepository.FindJourneysByUser(traveller);

            try
            {
                Assert.AreEqual(1,journeyList.Count);
            }
            finally
            {
                journeyRepository.Delete(journey);
                userRepository.Delete(traveller);
            }
        }
        public void ShouldTestInvalidUserLogin()
        {
            UserName name = new UserName("Bill", "Clinton");
            Email email = new Email("*****@*****.**");
            User nonExistentUser = new User(email, name, "pwd", null);

            _mockRepository.Setup(ur => ur.LoadUser(nonExistentUser.EmailAddress)).Returns((User)null);
            UserRegistration.UserRegistrationService service = new UserRegistrationService(_mockRepository.Object);

            Assert.False(service.AreCredentialsValid(email.EmailAddress, nonExistentUser.Password));
        }
        public void testUserRegistration()
        {
            UserName name = new UserName("Bill", "Clinton");
            Email email = new Email("*****@*****.**");
            User user = new User(email, name, "pwd", null);

            IUserRepository userRepository = UserRepository.Instance;
            UserRegistration.UserRegistrationService service = new UserRegistrationService(userRepository);

            service.CreateUser(user);
            userRepository.Delete(user);
        }