public void BTA1032_ST1270_SOAP_AuthenticateMember_WrongPassword()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";

            try
            {
                Logger.Info("Test Method Started");
                Common common = new Common(this.DriverContext);
                CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member member = cdis_Service_Method.AddCDISMemberWithAllFields();
                testStep.SetOutput("IpCode: " + member.IpCode + ", UserName: "******"IpCode: " + member.IpCode + ", Name: " + member.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Authenticating a Member with identity type as UserName";
                var output = cdis_Service_Method.AuthenticateMember("UserName", member.Username, "Password1*12", string.Empty, out time);
                //    Assert.AreEqual("Authentication error:Provided password is incorrect", output.StatusText, "Actual value is " + output.StatusText + "Expected value is Authentication error:Provided password is incorrect");
                testStep.SetOutput("The login status from Service is received as expected. " + output.LoginStatus);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validate the response of Authenticate Member";
                Assert.AreEqual("False", output.Authenticated.ToString(), "Expected value is True and the Actual value is" + output.Authenticated.ToString());
                Assert.AreEqual("Failure", output.LoginStatus, "Expected value is Success and the Actual value is" + output.LoginStatus);
                testStep.SetOutput("Authenticated: " + output.Authenticated + " and LoginStatus: " + output.LoginStatus + " are verified from the response");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(true);
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA1032_ST1251_SOAP_AuthenticateMember_VerifyElapsedTime()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            double time     = 0;

            try
            {
                Logger.Info("Test Method Started");
                Common common = new Common(this.DriverContext);
                CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member member = cdis_Service_Method.AddCDISMemberWithAllFields();
                testStep.SetOutput("IpCode: " + member.IpCode + ", UserName: "******"IpCode: " + member.IpCode + ", Name: " + member.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Authenticating a Member and verifying the elapsed time";
                var output = cdis_Service_Method.AuthenticateMember("PrimaryEmailAddress", member.PrimaryEmailAddress, "Password1*", string.Empty, out time);
                testStep.SetOutput("Authenticated: " + output.Authenticated + " and LoginStatus: " + output.LoginStatus + " from the response with elapsed time " + time);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validate the response of Authenticate Member";
                Assert.AreEqual("True", output.Authenticated.ToString(), "Expected value is True and the Actual value is" + output.Authenticated.ToString());
                Assert.AreEqual("Success", output.LoginStatus, "Expected value is Success and the Actual value is" + output.LoginStatus);
                testStep.SetOutput("Authenticated: " + output.Authenticated + " and LoginStatus: " + output.LoginStatus + " are verified from the response");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(true);
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA796_CDIS_PasswordResetOptions_Positive()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);

            try
            {
                Logger.Info("Test Method Started: " + testCase.GetTestCaseName());
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.AddCDISMemberWithAllFields();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                Logger.Info("TestStep: " + stepName + " ##Passed## IpCode:" + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                IList <VirtualCard> vc = output.GetLoyaltyCards();


                //         MemberDetails memberdet = new MemberDetails();
                //        var test = memberdet.MobilePhone;

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Get PasswordReset Options for a member using LoyaltyIDNumber";
                var response = cdis_Service_Method.GetPasswordResetOptionsUsingLoyaltyID(vc[0].LoyaltyIdNumber);
                testStep.SetOutput("The Masked Email and SMS from the response are :" + response.Email + " and " + response.SMS);
                Logger.Info("TestStep: " + stepName + " ##Passed## The Masked Email and SMS from the response are :" + response.Email + " and " + response.SMS);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Verify the masked Email and SMS using Addmember response and ATS_Memberdetails table";
                var       maskedEmail   = response.Email;
                string [] Emailnew      = maskedEmail.Split('@');
                var       maskedPhone   = response.SMS;
                string    dbresponse    = DatabaseUtility.GetFromSoapDB("ATS_MEMBERDETAILS", "A_IPCODE", output.IpCode.ToString(), "A_MOBILEPHONE", string.Empty);
                var       expectedPhone = dbresponse.Replace(dbresponse.Substring(3, 5), "?????");
                Assert.IsTrue(output.PrimaryEmailAddress.Contains(Emailnew[0].Replace("?", "").Trim()));
                Assert.AreEqual(expectedPhone, maskedPhone, "Expected value is" + expectedPhone + "Actual value is" + maskedPhone);
                testStep.SetOutput("The expected Email is:; " + output.PrimaryEmailAddress + " ;and actual masked email is :" + response.Email
                                   + ";The expected masked Phonenumber is: " + expectedPhone + " ;and actual masked Phone is :" + response.SMS);
                Logger.Info("TestStep: " + stepName + " ##Passed## The expected Email is:; " + output.PrimaryEmailAddress + " ;and actual masked email is :" + response.Email
                            + ";The expected masked Phonenumber is: " + expectedPhone + " ;and actual masked Phone is :" + response.SMS);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                Logger.Info("###Test Execution Ends### Test Passed: " + testCase.GetTestCaseName());
                testCase.SetStatus(true);
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA139_CSP_Member_Search()
        {
            ProjectBasePage basePages = new ProjectBasePage(driverContext);

            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string stepName = "";
            bool   stepstatus;

            try
            {
                Common common = new Common(DriverContext);

                #region Precondtion:Create Members
                CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.AddCDISMemberWithAllFields();

                string LoyaltyNumber = DatabaseUtility.GetLoyaltyID(output.IpCode.ToString());
                testStep.SetOutput("Generated :" + output.IpCode + ",Name:" + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step1:Launch CSPortal Portal
                stepName = "Launch Customer Service Portal URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                var CSP_LoginPage = new CSPortal_LoginPage(DriverContext);

                CSP_LoginPage.LaunchCSPortal(login.Csp_url, out string Step_Output); testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step2:Login As csadmin
                stepName = "Login As csadmin User";
                testStep = TestStepHelper.StartTestStep(testStep);

                login.UserName = CsPortalData.csadmin;
                login.Password = CsPortalData.csadmin_password;
                CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3:Search Based on Loyalty ID
                stepName = "Search Based on Loyalty ID";
                testStep = TestStepHelper.StartTestStep(testStep);
                var CSPSearchPage = new CSPortal_SearchPage(DriverContext);
                stepstatus = CSPSearchPage.Search_BasedOnLoyaltyID(LoyaltyNumber, out Step_Output); testStep.SetOutput(Step_Output);
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4:Select and Verify Loyalty ID
                stepName = "Select and Verify Loyalty ID";

                testStep = TestStepHelper.StartTestStep(testStep);
                CSPSearchPage.Select(output.FirstName);
                var CSPAccountSummaryPage = new CSPortal_MemberAccountSummaryPage(DriverContext);
                stepstatus = CSPAccountSummaryPage.VerifyLoyaltyId(LoyaltyNumber, out Step_Output); testStep.SetOutput(Step_Output);
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5:Search Based on Email ID
                stepName = "Search Based on Email ID";
                var CSP_HomePage = new CSPortal_HomePage(DriverContext);
                CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.MemberSearch, out stepName);
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSPSearchPage.Search_EmailID(output.PrimaryEmailAddress, out Step_Output); testStep.SetOutput(Step_Output);

                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6:Search Based on FirstName
                stepName   = "Search Based on FirstName";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSPSearchPage.Search_FirstName(output.FirstName, out Step_Output); testStep.SetOutput(Step_Output);

                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7:Search Based on Last Name
                stepName   = "Search Based on Last Name";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSPSearchPage.Search_LastName(output.LastName, out Step_Output); testStep.SetOutput(Step_Output);

                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step8:Search With no Inputs
                stepName   = "Search With no Inputs";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSPSearchPage.Search_WithBlankInputs(out Step_Output); testStep.SetOutput(Step_Output);

                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step9:Logout As csadmin
                stepName = "Logout As csadmin";
                testStep = TestStepHelper.StartTestStep(testStep);


                CSP_HomePage.LogoutCSPortal();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                testCase.SetStatus(true);
            }

            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName + e, false, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                testCase.SetImageContent(DriverContext.TakeScreenshot().ToString());
                Assert.Fail();
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }