public void AccountProviderConstructorTest()
 {
     IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
     ICaptchaProvider captchaProvider = new ReCaptchaProvider();
     IEmailProvider emailProvider = new EmailProvider();
     IMobileProvider mobileProvider = new MobileProvider();
     var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);
     Assert.IsNotNull(target);
 }
 public void ValidateTest1()
 {
     var target = new ReCaptchaProvider();
     string challenge = "hello";
     string ipAddress = "127.0.0.1";
     string response = "no";
     bool expected = false;
     bool actual;
     actual = target.Validate(challenge, ipAddress, response);
     Assert.AreEqual(expected, actual);
 }
        public void UpdatePersonalInfoTest()
        {
            IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
            ICaptchaProvider captchaProvider = new ReCaptchaProvider();
            IEmailProvider emailProvider = new EmailProvider();
            IMobileProvider mobileProvider = new MobileProvider();
            var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);

            string errorMessage = null;
            var account = new Account();
            account.FirstName = "Upcurve";
            account.LastName = "Udchalo";
            account.BillingAddress = new Address
                                         {
                                             Id = 0,
                                             AddressLine1 = "EON, Kharadi",
                                             AddressLine2 = "Tavisca Solutions, Pune",
                                             AddressType = AddressType.Billing,
                                             City = "Pune",
                                             Country = "IN",
                                             State = "Maharashtra",
                                             ZipCode = "4110001"
                                         };

            Account updatedAccount = target.UpdatePersonalInfo(account, out errorMessage);
            Assert.IsTrue(updatedAccount != null);
            Assert.IsTrue(string.IsNullOrEmpty(errorMessage));
        }
        public void UpdatePasswordTest1()
        {
            IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
            ICaptchaProvider captchaProvider = new ReCaptchaProvider();
            IEmailProvider emailProvider = new EmailProvider();
            IMobileProvider mobileProvider = new MobileProvider();
            var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);

            bool expected = true;
            bool actual;
            actual = target.UpdatePassword(accountId, "1qaz1qaz");
            Assert.AreEqual(actual, expected);
        }
        public void UpdatePasswordTest()
        {
            IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
            ICaptchaProvider captchaProvider = new ReCaptchaProvider();
            IEmailProvider emailProvider = new EmailProvider();
            IMobileProvider mobileProvider = new MobileProvider();
            var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);

            string currentPassword = password;
            string newPassword = password + "test";
            bool expected = true;
            bool actual;
            actual = target.UpdatePassword(accountId, currentPassword, newPassword);
        }
 public void SetMobileVerifiedTest()
 {
     IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
     ICaptchaProvider captchaProvider = new ReCaptchaProvider();
     IEmailProvider emailProvider = new EmailProvider();
     IMobileProvider mobileProvider = new MobileProvider();
     var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);
     Account account = target.GetAccount(accountId);
     target.SetMobileVerified(account);
     account = target.GetAccount(accountId);
     Assert.IsTrue(account.IsMobileVerified);
 }
        public void SaveOrUpdateTravellerTest()
        {
            IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
            ICaptchaProvider captchaProvider = new ReCaptchaProvider();
            IEmailProvider emailProvider = new EmailProvider();
            IMobileProvider mobileProvider = new MobileProvider();
            var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);

            string errorMessage = null;
            Traveller tav = new Traveller()
            {
                AccountId = Convert.ToInt32(accountId),
                TravellerId = 1,
                FirstName = "Test",
                LastName = "Traveller",
                Title = "Mr.",
                DateOfBirth = DateTime.Now.AddYears(-27),
                Gender = "Male"
            };

            Traveller updatedTraveller = target.SaveOrUpdateTraveller(tav, out errorMessage);
            Assert.IsTrue(updatedTraveller != null);
            Assert.IsTrue(string.IsNullOrEmpty(errorMessage));
        }
        public void GetAccountIdTest()
        {
            IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
            ICaptchaProvider captchaProvider = new ReCaptchaProvider();
            IEmailProvider emailProvider = new EmailProvider();
            IMobileProvider mobileProvider = new MobileProvider();
            var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);

            string accountType = string.Empty;
            string expected = accountId;
            string actual;
            actual = target.GetAccountId(email, accountType);
            accountId = actual;
        }
 public void ReCaptchaProviderConstructorTest()
 {
     var target = new ReCaptchaProvider();
 }
        public void MergeSocialTest()
        {
            IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
            ICaptchaProvider captchaProvider = new ReCaptchaProvider();
            IEmailProvider emailProvider = new EmailProvider();
            IMobileProvider mobileProvider = new MobileProvider();
            var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);

            bool expected = true;
            bool actual;
            actual = target.MergeSocial(socialAccountId, socialAccountType, email);
        }
        public void LoginTest()
        {
            IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
            ICaptchaProvider captchaProvider = new ReCaptchaProvider();
            IEmailProvider emailProvider = new EmailProvider();
            IMobileProvider mobileProvider = new MobileProvider();
            var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);

            string type = string.Empty;
            string authId = string.Empty;
            Account actual;
            actual = target.Login(email, password, type, out authId);
        }
        public void IsValidTest1()
        {
            IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
            ICaptchaProvider captchaProvider = new ReCaptchaProvider();
            IEmailProvider emailProvider = new EmailProvider();
            IMobileProvider mobileProvider = new MobileProvider();
            var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);

            bool expected = false;
            bool actual;
            actual = target.IsValid(accountId, "123");
            Assert.AreEqual(actual, expected);
        }
 public void IsValidTest()
 {
     IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
     ICaptchaProvider captchaProvider = new ReCaptchaProvider();
     IEmailProvider emailProvider = new EmailProvider();
     IMobileProvider mobileProvider = new MobileProvider();
     var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);
     string authenticationId = authenticationProvider.CreateAuthenticationId(accountId);
     bool expected = true;
     bool actual;
     actual = target.IsValid(authenticationId);
     Assert.AreEqual(expected, actual);
 }
 public void GetTravellersTest()
 {
     IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
     ICaptchaProvider captchaProvider = new ReCaptchaProvider();
     IEmailProvider emailProvider = new EmailProvider();
     IMobileProvider mobileProvider = new MobileProvider();
     var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);
     List<Traveller> travellers = target.GetTravellers(accountId);
     Assert.IsTrue(travellers != null);
 }
        public void GetAccountTest()
        {
            IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
            ICaptchaProvider captchaProvider = new ReCaptchaProvider();
            IEmailProvider emailProvider = new EmailProvider();
            IMobileProvider mobileProvider = new MobileProvider();
            var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);

            Account expected = null;
            Account actual;
            actual = target.GetAccount(accountId);
            Assert.IsNotNull(actual);
        }
        public void GetAccountIdTest1()
        {
            IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
            ICaptchaProvider captchaProvider = new ReCaptchaProvider();
            IEmailProvider emailProvider = new EmailProvider();
            IMobileProvider mobileProvider = new MobileProvider();
            var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);

            string expected = accountId;
            string actual;
            actual = target.GetAccountId(socialAccountId, socialAccountType);
            Assert.AreEqual(expected, actual);
        }
        public void ChangeEmailTest()
        {
            IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
            ICaptchaProvider captchaProvider = new ReCaptchaProvider();
            IEmailProvider emailProvider = new EmailProvider();
            IMobileProvider mobileProvider = new MobileProvider();
            var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);

            bool expected = true;
            bool actual;
            actual = target.ChangeEmail(accountId, email);
            Assert.AreEqual(actual, expected);
        }
        public void RegisterSocialTest()
        {
            if (accountId == null)
            {
                IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
                ICaptchaProvider captchaProvider = new ReCaptchaProvider();
                IEmailProvider emailProvider = new EmailProvider();
                IMobileProvider mobileProvider = new MobileProvider();
                var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider,
                                                 mobileProvider);

                string ipAddress = "127.0.0.1";
                string authId = string.Empty;
                bool accountExists = true;
                bool accountExistsExpected = true;
                bool expected = true;
                bool actual;
                actual = target.RegisterSocial(socialAccountId, socialAccountType, email, firstName, lastName, mobile,
                                               ipAddress, out authId, out accountExists);
                Assert.IsNotNull(authId);
                Assert.AreEqual(expected, actual);
                accountId = target.GetAccountId(socialAccountId, socialAccountType);
            }
        }
        public void RegisterTest()
        {
            if (accountId == null)
            {
                IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
                ICaptchaProvider captchaProvider = new ReCaptchaProvider();
                IEmailProvider emailProvider = new EmailProvider();
                IMobileProvider mobileProvider = new MobileProvider();
                var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider,
                                                 mobileProvider);

                string captchaChallenge = "test";
                string captchaResponse = "test";
                string ipAddress = "127.0.0.1";
                string authId = string.Empty;
                bool accountExists = true;
                bool accountExistsExpected = false;
                bool captchaValid = false;
                bool captchaValidExpected = true;
                bool expected = true;
                bool actual;
                actual = target.Register(email, firstName, lastName, mobile, captchaChallenge, captchaResponse,
                                         ipAddress, out authId, out accountExists, out captchaValid);
                Assert.IsNotNull(authId);
                Assert.AreEqual(captchaValidExpected, captchaValid);
                Assert.AreEqual(expected, actual);
                accountId = target.GetAccountId(email);
            }
        }
 public void ForgotPasswordTest()
 {
     IAuthenticationProvider authenticationProvider = new AuthenticationProvider(new HttpRuntimeCache());
     ICaptchaProvider captchaProvider = new ReCaptchaProvider();
     IEmailProvider emailProvider = new EmailProvider();
     IMobileProvider mobileProvider = new MobileProvider();
     var target = new AccountProvider(authenticationProvider, captchaProvider, emailProvider, mobileProvider);
     bool accountExists = false;
     bool accountExistsExpected = true;
     bool expected = true;
     bool actual;
     actual = target.ForgotPassword(accountId, out accountExists);
     Assert.AreEqual(accountExistsExpected, accountExists);
     Assert.AreEqual(expected, actual);
 }