コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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));
        }
コード例 #5
0
 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);
 }
コード例 #6
0
        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;
        }
コード例 #7
0
        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);
            }
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
 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);
 }
コード例 #11
0
        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);
        }
コード例 #12
0
 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);
 }
コード例 #13
0
        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);
        }
コード例 #14
0
        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);
        }
コード例 #15
0
 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);
 }
コード例 #16
0
        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);
            }
        }
コード例 #17
0
        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);
        }
コード例 #18
0
 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);
 }