Ejemplo n.º 1
0
        public void CanExecuteResetPasswordStep2()
        {
            foreach (var testUser in TestAccounts.Accounts)
            {
                var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                              testUser.Username);

                var payload = new UserAuthenticationRequest()
                {
                    UserName = testUser.Username,
                    FullSsn  = testUser.FullSsn
                };

                var step1Result = ApiUtil.PostJson <dynamic>(ctx, "Animation/Membership/Password/Reset0", payload);

                Assert.IsNotNull(step1Result);
                Assert.AreEqual(HttpStatusCode.OK, step1Result.Item1);
                Assert.IsNotNull(step1Result.Item2);

                payload.SecretQuestion = step1Result.Item2.Question;
                payload.SecretAnswer   = testUser.SecretAnswer;
                payload.NewPassword    = testUser.Password;

                var step2Result = ApiUtil.PostJson <dynamic>(ctx, "Animation/Membership/Password/Reset2", payload);

                Assert.IsNotNull(step2Result);
                Assert.AreEqual(HttpStatusCode.OK, step2Result.Item1);
                Assert.IsNotNull(step2Result.Item2);
            }
        }
Ejemplo n.º 2
0
        public void CanGetConfigurationValues()
        {
            var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                          "*****@*****.**");

            var urlResults = ApiUtil.GetJsonResult <dynamic>(ctx,
                                                             String.Format("Animation/Settings/GetConfigurationValues/{0}/{1}",
                                                                           ctx.Employer.Id,
                                                                           ctx.Employer.HandshakeId));

            Assert.IsNotNull(urlResults.Security);
        }
Ejemplo n.º 3
0
        public void CanGetConfigurationValue()
        {
            var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                          "*****@*****.**");

            var urlResults = ApiUtil.GetJsonResult <dynamic>(ctx,
                                                             String.Format("Animation/Settings/{0}/{1}/ConfigValue/?configKey=NetworkLatencyThresholdJson",
                                                                           ctx.Employer.HandshakeId,
                                                                           ctx.Employer.Id));

            Assert.IsNotNull(urlResults.Results.Id);
        }
Ejemplo n.º 4
0
        public void CanGetMobilePhone()
        {
            foreach (var testUser in TestAccounts.Accounts)
            {
                var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                              testUser.Username);

                var result = ApiUtil.GetJsonResult <dynamic>(ctx, "Animation/Membership/Phone/Mobile");

                Assert.IsNotNull(result);
            }
        }
Ejemplo n.º 5
0
        public void CanGetIdCardsE2E()
        {
            if (!Debugger.IsAttached)
            {
                return;
            }

            var ctx = UnitTestContext.Get(Environment.LocalWapi, "*****@*****.**");

            var result = ApiUtil.GetJsonResult <ApiResult <List <IdCard.Data.IdCard> > >(ctx, @"v2/IdCards");

            Assert.IsNotNull(result);
        }
Ejemplo n.º 6
0
        public void CanGetMediaUrl()
        {
            var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                          "*****@*****.**");

            // This needs to be made dynamic somehow.  Also, the api returns a string even if
            // there's no matching record in the database.  The api should be updated to return a
            // 404 if there's no matching database record.
            var results = ApiUtil.GetJsonResult <dynamic>(ctx,
                                                          String.Format("Animation/Media/MediaUrl/{0}",
                                                                        "14.38"));

            Assert.IsNotNull(results);
        }
Ejemplo n.º 7
0
        public void CanGetWapiAuthResult()
        {
            //var authResult = UnitTestContext.Get(ClearCost.UnitTesting.Environment.lawapi, @"*****@*****.**").GetAuthResult();
            //var authResult = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(), @"*****@*****.**").GetAuthResult();
            //var authResult = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(), @"*****@*****.**").GetAuthResult();
            //var authResult = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(), @"*****@*****.**").GetAuthResult("password1");
            //var authResult = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(), @"*****@*****.**").GetAuthResult();

            foreach (var testUser in TestAccounts.Accounts)
            {
                var authResult = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(), testUser.Username).GetAuthResult();
                Assert.IsNotNull(authResult);
                Assert.IsFalse(string.IsNullOrEmpty(authResult.AuthHash));
            }
        }
Ejemplo n.º 8
0
        public void CanGetPushPromptStatus()
        {
            var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                          "*****@*****.**");

            var result = ApiUtil.GetJsonResult <dynamic>(ctx,
                                                         String.Format("Animation/Messaging/PushPrompt/{0}/{1}/{2}",
                                                                       ctx.Employer.Id,
                                                                       ctx.Employer.HandshakeId,
                                                                       "96dcba2ce8e6a7d7ce57e05a75cf2902d721b47457fa64662ca2ae46e4ca9bce"
                                                                       ));

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.PromptStatus);
        }
Ejemplo n.º 9
0
        public void CanUpdateEmailAddress()
        {
            var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                          "*****@*****.**");

            dynamic payload = new ExpandoObject();

            payload.NewEmail = "*****@*****.**";

            var result = ApiUtil.PostJson <dynamic>(ctx,
                                                    "Animation/Membership/Email",
                                                    payload);

            Assert.IsNotNull(result);
            Assert.AreEqual(HttpStatusCode.OK, result.Item1);
        }
Ejemplo n.º 10
0
        public void CanGetUserContentLocale()
        {
            var    ctx    = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(), "*****@*****.**");
            string result = null;

            using (var webClient = new WebClient()) {
                webClient.Headers.Add(HttpRequestHeader.ContentType, "application/json");
                webClient.Headers.Add("ApiKey", "DB366C62-88B6-402D-BCB7-E3FC384776E1");
                webClient.Headers.Add("AuthHash", "631B756ADC1A2347E1815DD719BB59E1A032C345AE8C6539C22C568CC5DCBBF0D55A0BF28C3A0AC638D7C399E469A0658CB2E028517F521B98DE3D6192BA5AB08D52BF36035C6FB812F53F89F1EB83BF5BEDC6688BEDACFAB657C15673335CA64FD7BF1C1334354B89E41E025E8479D0");

                result = webClient.DownloadString(String.Format("{0}/v1/Animation/UserContent/UserContentLocale/en/0/", ctx.RootUri));
            }


            Assert.IsNotNull(result);
        }
Ejemplo n.º 11
0
        public void CanUpdatePhone()
        {
            foreach (var testUser in TestAccounts.Accounts)
            {
                var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                              testUser.Username);

                var payload = new AccountRequest();
                payload.NewAlternatePhone = testUser.Phone;

                var result = ApiUtil.PostJson <dynamic>(ctx,
                                                        "Animation/Membership/Phone/Alt", payload, testUser.Password);

                Assert.IsNotNull(result);
                Assert.AreEqual(HttpStatusCode.OK, result.Item1);
            }
        }
Ejemplo n.º 12
0
        public void CanChangePassword()
        {
            foreach (var testUser in TestAccounts.Accounts)
            {
                var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                              testUser.Username);

                var payload = new UserAuthenticationRequest();
                payload.Password    = testUser.Password;
                payload.NewPassword = testUser.Password;

                var result = ApiUtil.PostJson <dynamic>(ctx, "Animation/Membership/Password",
                                                        payload, testUser.Password);

                Assert.IsNotNull(result);
                Assert.AreEqual(HttpStatusCode.OK, result.Item1);
            }
        }
Ejemplo n.º 13
0
        public void CanGetPlanInfoFromWapi()
        {
            SqlMapper.SetTypeMap(typeof(HealthPlanSummary), new ColumnAttributeTypeMapper <HealthPlanSummary>());
            var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                          "*****@*****.**");

            var summary = ApiUtil.GetJsonResult <HealthPlanSummary>(ctx, "Animation/HealthPlanSummary");

            Assert.IsNotNull(summary);
            Assert.IsFalse(string.IsNullOrEmpty(summary.PlanName));
            Assert.AreNotEqual(0, summary.Deductible);
            Assert.IsFalse(summary.AsOfDate.HasValue);
            Assert.IsFalse(summary.YearToDateSpent.HasValue);
            Assert.AreNotEqual(0, summary.Deductible);
            Assert.IsTrue(!summary.Coinsurance.HasValue || !summary.Coinsurance.Value.Equals(0));
            Assert.AreNotEqual(0, summary.CoinsuranceComplement);
            Assert.IsTrue(!summary.Copay.HasValue || !summary.Copay.Value.Equals(0));
            Assert.AreNotEqual(0, summary.OutOfPocketMax);
        }
Ejemplo n.º 14
0
        public void CanUpdateSecretAnswer()
        {
            foreach (var testUser in TestAccounts.Accounts)
            {
                var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                              testUser.Username);

                var payload = new UserAuthenticationRequest {
                    Password     = testUser.Password,
                    SecretAnswer = testUser.SecretAnswer
                };

                var result = ApiUtil.PostJson <dynamic>(ctx,
                                                        "Animation/Membership/SecurityAnswer", payload, testUser.Password);

                Assert.IsNotNull(result);
                Assert.AreEqual(HttpStatusCode.OK, result.Item1);
            }
        }
Ejemplo n.º 15
0
        public void LoginRequiresHandshakeId()
        {
            foreach (var testUser in TestAccounts.Accounts)
            {
                var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                              testUser.Username);

                dynamic payload = new ExpandoObject();
                payload.username = testUser.Username;
                payload.password = testUser.Password;

                var results = ApiUtil.PostJson <dynamic>(ctx,
                                                         "Animation/Membership/Login/",
                                                         payload);

                Assert.IsNotNull(results);
                Assert.AreEqual(HttpStatusCode.Unauthorized, results.Item1);
            }
        }
Ejemplo n.º 16
0
        //[TestCategory("Integration Tests")]
        public void CanLogin()
        {
            foreach (var testUser in TestAccounts.Accounts)
            {
                var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                              testUser.Username);

                dynamic payload = new ExpandoObject();
                payload.username = testUser.Username;
                payload.password = testUser.Password;

                var results = ApiUtil.PostJson <dynamic>(ctx,
                                                         String.Format("Animation/Membership/Login/{0}", ctx.Employer.HandshakeId),
                                                         payload);

                Assert.IsNotNull(results);
                Assert.AreEqual(HttpStatusCode.OK, results.Item1);
            }
        }
Ejemplo n.º 17
0
        public void CanLogInitialExperience()
        {
            var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                          "*****@*****.**");

            var experienceLogRequest = new ExperienceLogRequest {
                EmployerId = 21,
                EventName  = "Unit Test",
                LogComment = "confirming route works.",
                DeviceId   = "0"
            };

            var urlResult = ApiUtil.PostJson <HttpResponseMessage>(ctx,
                                                                   String.Format("Animation/Experience/LogInitial/{0}", ctx.Employer.HandshakeId),
                                                                   experienceLogRequest);

            Assert.IsNotNull(urlResult);
            Assert.AreEqual(HttpStatusCode.OK, urlResult.Item1);
        }
Ejemplo n.º 18
0
        public void CanUpdatePushPromptStatus()
        {
            var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                          "*****@*****.**");

            dynamic payload = new ExpandoObject();

            payload.EmployerId = 21;
            payload.EventName  = "Unit Test";
            payload.LogComment = "confirming route works.";
            payload.DeviceId   = 0;

            var result = ApiUtil.PostJson <ApiResult <dynamic> >(ctx,
                                                                 String.Format("Animation/Messaging/PushPrompt/{0}",
                                                                               ctx.Employer.Id),
                                                                 payload);

            Assert.IsNotNull(result);
            Assert.AreEqual(HttpStatusCode.OK, result.Item1);
        }
Ejemplo n.º 19
0
        public void CanExecuteResetPasswordStep1()
        {
            foreach (var testUser in TestAccounts.Accounts)
            {
                var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                              testUser.Username);

                var payload = new UserAuthenticationRequest()
                {
                    UserName = testUser.Username,
                    FullSsn  = testUser.FullSsn
                };

                var step1Result = ApiUtil.PostJson <dynamic>(ctx, "Animation/Membership/Password/Reset0", payload);

                Assert.IsNotNull(step1Result);
                Assert.AreEqual(HttpStatusCode.OK, step1Result.Item1);
                Assert.IsNotNull(step1Result.Item2);
                string authHash = step1Result.Item2.AuthHash;
                Assert.IsFalse(string.IsNullOrEmpty(authHash));
            }
        }
Ejemplo n.º 20
0
        public void CanUseWapiToViewIdCard()
        {
            var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                          "*****@*****.**");

            dynamic memberUrlsResult = ApiUtil.GetJsonResult <dynamic>(ctx, "Animation/Card/CardUrls/en");

            Assert.IsNotNull(memberUrlsResult);

            Assert.IsNotNull(memberUrlsResult.Results);
            List <CardResult> cardResults = memberUrlsResult.Results.ToObject <List <CardResult> >();

            var authResult = ctx.GetAuthResult();

            cardResults.ForEach(r => {
                Debug.WriteLine(r.CardUrl);
                var result = ApiUtil.GetContentResult(ctx, r.CardUrl, false, string.Empty, authResult);

                Assert.IsFalse(string.IsNullOrEmpty(result));
                Assert.IsFalse(result.Contains("Something went wrong"));
            });
        }
Ejemplo n.º 21
0
        public void CanUseWapiToEmailIdCard()
        {
            var ctx = UnitTestContext.Get(EnvironmentHelper.GetEnvironment(),
                                          "*****@*****.**");

            var memberUrlsResult = ApiUtil.GetJsonResult <dynamic>(ctx, "Animation/Card/CardUrls/en");

            Assert.IsNotNull(memberUrlsResult);

            var cardWebRequest = new MemberCardWebRequest()
            {
                CardToken = memberUrlsResult.Results[0].SecurityToken,
                ToEmail   = "*****@*****.**",
                Subject   = "CanEmailIdCard Unit Test",
                Message   = "Unit test result"
            };

            var emailResult = ApiUtil.PostJson <MemberCardWebRequest>(ctx, "Animation/Card/Email", cardWebRequest);

            Assert.IsNotNull(emailResult);
            Assert.AreEqual(HttpStatusCode.OK, emailResult.Item1);

            //var cardController = new CardController();
            //dynamic memberUrlsResult = cardController.GetMemberCardUrls("", TestAccounts.CaesarsAccounts.MarySmith.CchId);

            //Assert.IsNotNull(memberUrlsResult);

            //var cardWebRequest = new MemberCardWebRequest() {
            //    CardToken = memberUrlsResult.Results[0].SecurityToken,
            //    ToEmail = "*****@*****.**",
            //    Subject = "CanEmailIdCard Unit Test",
            //    Message = "Unit test result"
            //};

            //var emailResult = cardController.SendIdCardEmail(cardWebRequest);

            //Assert.IsNotNull(emailResult);
        }