public void ConfirmRegistration_GuidIsValidForExistentUser_ReturnRegistrationConfirmationSuccessfulView()
        {
            var userRegistrationModel = new UserRegistrationModel();
            userRegistrationModel.Save();

            var result = controller.ConfirmRegistration(userRegistrationModel.Id.ToString()) as ViewResult;

            Assert.IsNotNull(result);
            Assert.AreEqual("RegistrationConfirmationSuccessful", result.ViewName);
        }
        public void Initialize()
        {
            storage = new EfStorage(new EfStorageDbInitializerTest());
            storage.Database.Initialize(true);

            userRegistrationModel = new UserRegistrationModel()
            {
                Name = "nume",
                Email = "*****@*****.**",
                Password = "******",
                ConfirmedPassword = "******",
            };
        }
        public void Initialize()
        {
            efStorage = new EfStorage(new EfStorageDbInitializerTest());
            efStorage.Database.Initialize(true);

            uniqueEmailAttribute = new UniqueEmailAttribute();

            UserRegistrationModel userRegistrationModel = new UserRegistrationModel()
            {
                Name = "nume",
                Email = "*****@*****.**",
                Password = "******",
            };

            userRegistrationModel.Save();
        }
        public void Confirm_UserIdIsValidAndExists_SetIsConfirmedPropertyToTrue()
        {
            var userRegistrationModel = new UserRegistrationModel
            {
                Name = "name",
                Email = "*****@*****.**",
                Password = "******",
                ConfirmedPassword = "******"
            };

            userRegistrationModel.Save();

            registrationConfirmationModel.Confirm(userRegistrationModel.Id.ToString());

            var retrievedEntity = new UserRepository().GetBy(userRegistrationModel.Id);

            Assert.AreEqual(retrievedEntity.IsConfirmed, true);
        }
        public void Accept_BusinessTripIdInStorage_ReturnsStatusChangedSuccessfullyView()
        {
            var businessTripRepository = new BusinessTripsRepository();

            var userRegistrationModel = new UserRegistrationModel();
            userRegistrationModel.Save();

            var businessTripModel = new BusinessTripModel
            {
                User = new UserModel(userRegistrationModel.Id),
                StartingDate = DateTime.Now,
                EndingDate = DateTime.Now
            };

            businessTripRepository.Add(businessTripModel);
            businessTripRepository.SaveChanges();

            var result = controller.Accept(businessTripModel.Id) as ViewResult;

            Assert.IsNotNull(result);
            Assert.AreEqual("StatusChangedSuccessfully", result.ViewName);
        }
        public void GetId_ReturnsUserIdBasedOnEmail()
        {
            const string email = "*****@*****.**";

            UserRegistrationModel userRegistrationModel = new UserRegistrationModel
            {
                Name = "nume",
                Email = email,
                Password = "******",
                ConfirmedPassword = "******",
            };
            userRegistrationModel.Save();

            UserEntity expectedUser = new UserRepository().GetBy(email);

            var actualUser = new RecoverPasswordModel
            {
                Email = email
            };

            Assert.AreEqual(expectedUser.Id, actualUser.GetId());
        }
        public ActionResult Register(UserRegistrationModel userRegistrationModel)
        {
            if (!ModelState.IsValid)
            {
                return View("Register");
            }

            userRegistrationModel.Save();

            var email = new Email();
            email.SendUserRegistrationEmail(userRegistrationModel.Id, userRegistrationModel.Email);

            return View("RegistrationSuccessful");
        }
        public void Initialize()
        {
            EfStorage storage = new EfStorage(new EfStorageDbInitializerTest());
            storage.Database.Initialize(true);

            userRegistrationModel = new UserRegistrationModel()
            {
                Email = "*****@*****.**",
                Password = "******"
            };

            userRegistrationModel.Save();

            userModel = new UserModel(userRegistrationModel.Id);

            businessTripsRepository = new BusinessTripsRepository();

            businessTripModel = new BusinessTripModel
            {
                Id = Guid.NewGuid(),
                EndingDate = DateTime.Now,
                StartingDate = DateTime.Now,
                User = userModel
            };

            businessTripsRepository.SaveChanges();
        }
        public void TestInitialize()
        {
            storage.Database.Initialize(true);

            userRegistrationModel = new UserRegistrationModel()
            {
                Name = "nume",
                Email = "*****@*****.**",
                Password = "******",
                ConfirmedPassword = "******",
            };

            userRegistrationModel.Save();
        }