Пример #1
0
        public void BTA1230_ST1388_AwardLoyaltyCurrency_CurrencyAmountZero()
        {
            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);
            List <string>        CategoryID          = new List <string>();
            List <string>        DBCategoryID        = new List <string>();

            try
            {
                Logger.Info("Test Method Started: " + testCase.GetTestCaseName());
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                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();

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Award LoyaltyCurrency to a member using AwardLoyaltyCurrency method where currency amount is 0";
                decimal? amount          = 0;
                DateTime expirationdate  = new DateTime(DateTime.Now.Year, 12, 31);
                DateTime?transactiondate = DateTime.Now;
                string   errorMsg        = cdis_Service_Method.AwardLoyaltyCurrencyInvalid(vc[0].LoyaltyIdNumber, LoyaltyEvents.PurchaseActivity, LoyaltyCurrency.BasePoints, amount, transactiondate, expirationdate, "Awarding new amounts", "SOAPService");
                if (errorMsg.Contains("Error code=3313") && errorMsg.Contains("Error Message=0 points were requested.  Loyalty currency canot be 0"))
                {
                    testStep.SetOutput("The Error message from Service is received as expected. " + errorMsg);
                    Logger.Info("The Error message from Service is received as expected. " + errorMsg);
                }
                else
                {
                    throw new Exception("Error not received as expected error: 3362. Actual error received is" + errorMsg);
                }
                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);
                Logger.Info("Test Failed: " + testCase.GetTestCaseName() + "Reason: " + e.Message);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
Пример #2
0
        public void BTA1228_ST1352_SOAP_CreateCsNote_InvalidMemberIdentity()
        {
            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
            {
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Create CS Note with invalid memberidentity";
                IList <VirtualCard> vc = output.GetLoyaltyCards();
                string memberIdentity  = "";
                memberIdentity = common.RandomNumber(7);
                string value = DatabaseUtility.GetFromSoapDB("lw_virtualcard", "LOYALTYIDNUMBER", memberIdentity, "LOYALTYIDNUMBER", string.Empty);
                while (value == memberIdentity)
                {
                    memberIdentity = common.RandomNumber(7);
                    value          = DatabaseUtility.GetFromSoapDB("lw_virtualcard", "LOYALTYIDNUMBER", memberIdentity, "LOYALTYIDNUMBER", string.Empty);
                }
                string error = cdis_Service_Method.CreateCsNoteInvalid(memberIdentity, "The customer password was reset", out elapsedTime);
                if (error.Contains("Error code=3302") && error.Contains("Error Message=Unable to find member with identity"))
                {
                    testStep.SetOutput("The Error message from Service is received as expected. " + error);
                    Logger.Info("The Error message from Service is received as expected. " + error);
                }
                else
                {
                    throw new Exception("Error not received as expected error: 3362. Actual error received is" + error);
                }
                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);
                Logger.Info("Test Failed: " + testCase.GetTestCaseName() + "Reason: " + e.Message);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA1235_ST1433_SOAP_RedeemMemberCouponByCertNmbr_NonExistingChannel()
        {
            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
            {
                IList <JToken> JsonData = ProjectBasePage.GetJSONData("CommonSqlStatements");
                string         sqlstmt  = (string)JsonData.FirstOrDefault()["Get_CertNumber_From_LWMemberCouponTable_With_EmptyDateRedeemed"];

                Logger.Info("Test Method Started: " + testCase.GetTestCaseName());
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Get a valid certificateNumber from LW_MemberCoupon table";
                string validCertNumber = DatabaseUtility.GetFromSoapDB(string.Empty, string.Empty, string.Empty, "CERTIFICATENMBR", sqlstmt);
                testStep.SetOutput("The valid certNumbr from LW_MemberCoupon table is: " + validCertNumber);
                Logger.Info("The valid certNumbr from LW_MemberCoupon table is: " + validCertNumber);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep       = TestStepHelper.StartTestStep(testStep);
                stepName       = "Redeem the member coupon with non existing channel and validate the Error Code:6003";
                redemptiondate = System.DateTime.Now;
                string channel = "test";
                string error   = cdis_Service_Method.RedeemMemberCouponByByCertNumber_Invalid(validCertNumber, channel, "en", redemptiondate, timesused, false, false, string.Empty);
                if (error.Contains("Error code=6003") && error.Contains("Error Message=Specified channel is not defined"))
                {
                    testStep.SetOutput("The ErrorMessage from Service is received as expected. " + error);
                    Logger.Info("The ErrorMessage from Service is received as expected. " + error);
                }
                else
                {
                    throw new Exception("Error not received as expected error: 6003. Actual error received is:\"" + error + "\"");
                }
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                //unredeem the cert again since we have less certificates
                cdis_Service_Method.UnRedeemMemberCouponByCertNumber(validCertNumber, out elapsedTime);
                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);
                Logger.Info("Test Failed: " + testCase.GetTestCaseName() + "Reason: " + e.Message);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA798_CDIS_GetRewardCategories_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);
            List <string>        CategoryID          = new List <string>();
            List <string>        DBCategoryID        = new List <string>();

            try
            {
                Logger.Info("Test Method Started: " + testCase.GetTestCaseName());
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Get the ParentCategoryID from LW_Category table";
                string dbresponse = DatabaseUtility.GetFromSoapDB("LW_Category", string.Empty, null, "PARENTCATEGORYID", string.Empty);
                testStep.SetOutput("The ParentCategoryID from LW_Category table is: " + dbresponse);
                Logger.Info(stepName + " : Passed: The ParentCategoryID from LW_Category table is: " + dbresponse);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validate the CategoryID's in LW_Category table";
                var rewardCategories = cdis_Service_Method.GetRewardCategories(long.Parse(dbresponse));
                foreach (var reward in rewardCategories)
                {
                    CategoryID.Add(reward.CategoryId.ToString());
                    string idDB = DatabaseUtility.GetFromSoapDB("LW_Category", "Name", reward.CategoryName.ToString(), "ID", string.Empty);
                    DBCategoryID.Add(idDB);
                    Assert.AreEqual(idDB, reward.CategoryId.ToString(), "Expected value is" + idDB + "Actual value is" + reward.CategoryId.ToString());
                }
                testStep.SetOutput("The CategoryID's from GetRewardCategories response are:; " +
                                   string.Join(";", CategoryID.ToArray()) + "; and the categoryID's from DB are:; " +
                                   string.Join(";", DBCategoryID.ToArray()));
                Logger.Info(stepName + " : Passed: The CategoryID's from GetRewardCategories response are:## " +
                            string.Join("##", CategoryID.ToArray()) + "; and the categoryID's from DB are:; " +
                            string.Join("##", DBCategoryID.ToArray()));
                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);
                Logger.Info("Test Failed: " + testCase.GetTestCaseName() + "Reason: " + e.Message);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
Пример #5
0
        public void BTA841_ST888_SOAP_ActivateMemberWithPassingNullValuesToFields()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            Common common = new Common(this.DriverContext);
            CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);
            String stepName = "";

            try
            {
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Activate the member by passing null values to fields";
                string output = cdis_Service_Method.ActivateMemberWithNullFields();
                testStep.SetOutput(output);
                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);
                Logger.Info("Test Failed: " + testCase.GetTestCaseName() + "Reason: " + e.Message);
                Assert.Fail(e.Message.ToString());
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
Пример #6
0
        public void BTA844_ST979_CDIS_DeactivateMemberWithPassingMemberIdentityNotExistInDB()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            Common common = new Common(this.DriverContext);
            CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);
            String stepName = "";

            try
            {
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Deactivate the member by passing member identity not exists in DB";
                string output = cdis_Service_Method.DeactivateMemberWithMemberIdentityNotExistsInDb();
                testStep.SetOutput(output);
                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);
                Logger.Info("Test Failed: " + testCase.GetTestCaseName() + "Reason: " + e.Message);
                Assert.Fail(e.Message.ToString());
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA238_CDIS_GetAccountActivityDetails_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
            {
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                IList <VirtualCard> vc = output.GetLoyaltyCards();
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Updating and posting transaction to a Member through UpdateMember method";
                DateTime date        = DateTime.Now.AddDays(-5);
                string   txnHeaderId = cdis_Service_Method.UpdateMember_AddTransactionRequiredDate(output, date);
                testStep.SetOutput("The TxnHeader ID of the transaction posted for the above user is : " + txnHeaderId);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Get Account Activity Details through GetAccountActivityDetails method";
                AccountActivityDetailsStruct[] ActivityDetailsStruct = cdis_Service_Method.GetAccountActivityDetails(txnHeaderId);
                testStep.SetOutput("The Sales Amount for the transaction: " + ActivityDetailsStruct[0].SaleAmount);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "validate the response from database";
                string dbresponse = DatabaseUtility.GetTxnAmountusingVCKeyDBSoap(txnHeaderId);
                Assert.AreEqual(ActivityDetailsStruct[0].SaleAmount + "", dbresponse, "Expected value is" + ActivityDetailsStruct[0].SaleAmount + "Actual value is" + dbresponse);
                testStep.SetOutput("TxnAmount value from the db is: " + dbresponse + " and the TxnAmount from the service is: " + ActivityDetailsStruct[0].SaleAmount);
                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);
            }
        }
Пример #8
0
        public void BTA1028_ST1056_SOAP_AssociateMemberSocialHandles_MemberWithNoSocialHandles()
        {
            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 output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Associate social handles for a member";
                vc       = output.GetLoyaltyCards();
                string msg = cdis_Service_Method.AssociateMemberSocialHandles(vc[0].LoyaltyIdNumber, providerType, providerUID, out elapsedTime);
                testStep.SetOutput(msg);
                Logger.Info(msg);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validate Associate social handles for a member are added successfully";
                vc       = output.GetLoyaltyCards();
                MemberSocialHandleStruct[] socialHandlesData = cdis_Service_Method.GetMemberSocialHandles(vc[0].LoyaltyIdNumber, out stepOutput);
                Assert.AreEqual(socialHandlesData[0].ProviderType, providerType, "Expected value is " + providerType + "actual value is " + socialHandlesData[0].ProviderType);
                Assert.AreEqual(socialHandlesData[0].ProviderUID, providerUID, "Expected value is " + providerUID + "actual value is" + socialHandlesData[0].ProviderUID);
                testStep.SetOutput("Social handles for a member are added successfully where loyaltyidnumber is: " + vc[0].LoyaltyIdNumber + " ,ProviderType: " + socialHandlesData[0].ProviderType +
                                   " and ProviderUID: " + socialHandlesData[0].ProviderUID);
                Logger.Info("Social handles for a member are added successfully where loylaty id is: " + vc[0].LoyaltyIdNumber + "ProviderType" + socialHandlesData[0].ProviderType +
                            " and ProviderUID" + socialHandlesData[0].ProviderUID);
                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 BTA1465_ST1790_SOAP_CancelCard_VerifyElapsedTime()
        {
            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
            {
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                Logger.Info("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                IList <VirtualCard> vc = output.GetLoyaltyCards();
                testStep.SetOutput("The member details are IpCode: " + output.IpCode + " , Name: " + output.FirstName + ", LoyaltyCardID is: "
                                   + vc[0].LoyaltyIdNumber);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Canceling Card through CancelCard method";
                cdis_Service_Method.CancelCard(vc[0].LoyaltyIdNumber, null, "SOAP_AUTOMATION", false, out elapsedtime);
                testStep.SetOutput("The following card has Canceled :" + vc[0].LoyaltyIdNumber);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "validate the card status from database";
                string dbresponse = DatabaseUtility.GetLoyaltyCardStatusfromDbSOAP(vc[0].LoyaltyIdNumber + "");
                Assert.AreEqual("Cancelled", (LoyaltyCard_Status)Convert.ToInt32(dbresponse) + "", "Expected value is Canceled and the Actual value is" + (LoyaltyCard_Status)Convert.ToInt32(dbresponse));
                testStep.SetOutput("The card status value from db is : " + dbresponse + " which means card status is : " + (LoyaltyCard_Status)Convert.ToInt32(dbresponse));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Verify elapsed time";
                Assert.AreEqual(elapsedtime > 0, true, "Expected Elapsed time is greater than 0 and actual Elapsed time is : " + elapsedtime);
                testStep.SetOutput("The elapsed time for CancelCard : " + elapsedtime);
                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 BTA151_ST1000_SOAP_LockDownMember_StatusReasonIsEqualTo255Characters_POSITIVE()

        {
            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 output = cdis_Service_Method.GetCDISMemberGeneral();
                vc = output.GetLoyaltyCards();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Locking down the member by passing Updated Status Reason of a member equal to 255 characters";
                //string error = (string)cdis_Service_Method.LockDownMemberUpdatedMemberStatusReason(common.RandomString(255), vc[0].LoyaltyIdNumber);
                string error = cdis_Service_Method.LockDownMember(vc[0].LoyaltyIdNumber, DateTime.Now, common.RandomString(255), string.Empty, out elapsedTime);
                Assert.AreEqual("pass", error, "Member with loyalty id: " + vc[0].LoyaltyIdNumber + " has not been locked");
                var getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber);
                testStep.SetOutput("Member detail's : IPCODE: " + vc[0].IpCode + " member status is:" + getAccountSummary.MemberStatus + " and the loyalty Id is : " + vc[0].LoyaltyIdNumber);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(true);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "validating the card status for lock down member from database";
                string dbresponse = DatabaseUtility.GetMemberStatusfromDbSOAP(output.IpCode + "");
                string value      = (Member_Status)Int32.Parse(dbresponse) + "";
                Assert.AreEqual(Member_Status.Locked.ToString(), value, "Expected value is" + Member_Status.Locked.ToString() + "Actual value is" + value);
                testStep.SetOutput("The cardstatus code from database for lockdown is : \"" + dbresponse + "\" and the member status: " + (Member_Status)Int32.Parse(dbresponse));
                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);
            }
        }
Пример #11
0
        public void BTA146_REST_GetAccountSummaryByID_Positive()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";

            common = new Common(this.DriverContext);
            rest_Service_Method = new REST_Service_Methods(common);

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                var     k      = member.Value <String>("isError");
                Logger.Info(k.GetType());
                Logger.Info(member.Value <String>("isError"));
                if (member.Value <String>("isError") == "False")
                {
                    testStep.SetOutput("Member is added through PostMember service and following are the details, IPCODE:= " + member["data"].Value <int>("id") + "; Name= " + member["data"].Value <String>("firstName"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Fetching Account Summary through rest service using IpCode";
                    JObject response = (JObject)rest_Service_Method.GetAccountSummaryByIpCode(member["data"].Value <int>("id") + "");
                    testStep.SetOutput("members current status and currency balance from reponse are \"" + response["data"].Value <string>("memberStatus") + "\" and \"" + response["data"].Value <int>("currencyBalance") + "\"");
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testCase.SetStatus(true);
                    Logger.Info("test passed");
                }
                else
                {
                    testStep.SetOutput(member.Value <String>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    Logger.Info("test  failed");
                    throw new Exception(member.Value <String>("developerMessage"));
                }
            }
            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);
                Logger.Info("test  failed" + e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA1468_ST1776_SOAP_ReplaceCard_WithSameMember_AlreadyExists()
        {
            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 output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Replacing card for the member";
                IList <VirtualCard> vc = output.GetLoyaltyCards();

                DateTime Datenew        = DateTime.Now;
                bool     transferPoints = true;
                string   response       = (string)cdis_Service_Method.ReplaceCardNegative(vc[0].LoyaltyIdNumber, vc[0].LoyaltyIdNumber, transferPoints, Datenew);
                string[] errors         = response.Split(';');
                string[] errorssplit    = errors[0].Split('=');
                string[] errorsnew      = errors[1].Split('=');
                testStep.SetOutput(response);
                Logger.Info(response);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validating the error code and the ErrorMessage for the Error Code";
                Assert.AreEqual("3226", errorssplit[1], "Expected value is" + "3226" + "Actual value is" + errorssplit[1]);
                testStep.SetOutput("The ErrorMessage from Service is: " + errorsnew[1]);
                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);
            }
        }
Пример #13
0
        public void BTA1230_ST1389_AwardLoyaltyCurrency_InvalidMemberIdentity()
        {
            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);
            List <string>        CategoryID          = new List <string>();
            List <string>        DBCategoryID        = new List <string>();

            try
            {
                Logger.Info("Test Method Started: " + testCase.GetTestCaseName());
                decimal  amount          = Convert.ToDecimal(common.RandomNumber(3));
                DateTime expirationdate  = new DateTime(DateTime.Now.Year, 12, 31);
                DateTime?transactiondate = DateTime.Now;
                string   memberIdentity  = common.RandomNumber(7);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Award LoyaltyCurrency to a member using AwardLoyaltyCurrency method where member identity not exists";
                string value = DatabaseUtility.GetFromSoapDB("lw_virtualcard", "LOYALTYIDNUMBER", memberIdentity, "LOYALTYIDNUMBER", string.Empty);
                while (value == memberIdentity)
                {
                    memberIdentity = common.RandomNumber(7);
                    value          = DatabaseUtility.GetFromSoapDB("lw_virtualcard", "LOYALTYIDNUMBER", memberIdentity, "LOYALTYIDNUMBER", string.Empty);
                }
                string errorMsg = cdis_Service_Method.AwardLoyaltyCurrencyInvalid(memberIdentity, LoyaltyEvents.PurchaseActivity, LoyaltyCurrency.BasePoints, amount, transactiondate, expirationdate, "Awarding new amounts", "CDISService");
                if (errorMsg.Contains("Error code=3305") && errorMsg.Contains("Error Message=Unable to find member with loyalty id"))
                {
                    testStep.SetOutput("The Error message from Service is received as expected. " + errorMsg);
                    Logger.Info("The Error message from Service is received as expected. " + errorMsg);
                }
                else
                {
                    throw new Exception("Error not received as expected error: 3362. Actual error received is" + errorMsg);
                }
                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);
                Logger.Info("Test Failed: " + testCase.GetTestCaseName() + "Reason: " + e.Message);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA1465_ST1673_SOAP_CancelCard_NullStatus()
        {
            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);
            GetAccountSummaryOut pointBalanceBeforeCancelCard, pointBalanceAfterCancelCard;

            try
            {
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                Logger.Info("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                IList <VirtualCard> vc = output.GetLoyaltyCards();
                pointBalanceBeforeCancelCard = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber);
                testStep.SetOutput("The member details are IpCode: " + output.IpCode + " , Name: " + output.FirstName + ", LoyaltyCardID is: "
                                   + vc[0].LoyaltyIdNumber + " and Currency Balance is : " + pointBalanceBeforeCancelCard.CurrencyBalance);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Canceling Card through CancelCard method with update status reason as null";
                string updatecardstatusreason = null;
                cdis_Service_Method.CancelCard(vc[0].LoyaltyIdNumber, null, updatecardstatusreason, false, out elapsedtime);
                testStep.SetOutput("The following card has Canceled :" + vc[0].LoyaltyIdNumber);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "validate the card status from database";
                string dbresponse = DatabaseUtility.GetLoyaltyCardStatusfromDbSOAP(vc[0].LoyaltyIdNumber + "");
                pointBalanceAfterCancelCard = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber);
                Assert.AreEqual("0", pointBalanceAfterCancelCard.CurrencyBalance.ToString(), "Expected value is \"0\" and the Actual value is: " + pointBalanceAfterCancelCard.CurrencyBalance.ToString());
                Assert.AreEqual("Cancelled", (LoyaltyCard_Status)Convert.ToInt32(dbresponse) + "", "Expected value is Canceled and the Actual value is" + (LoyaltyCard_Status)Convert.ToInt32(dbresponse));
                testStep.SetOutput("The card status value from db is : " + dbresponse + " which means card status is : " + (LoyaltyCard_Status)Convert.ToInt32(dbresponse) + " and Points balance after" +
                                   "card cancellation is: " + pointBalanceAfterCancelCard.CurrencyBalance.ToString());
                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);
            }
        }
Пример #15
0
        public void BTA844_ST_CDIS_DeactivateMember_LockedMember()
        {
            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);

                Logger.Info("Test Method Started: " + testCase.GetTestCaseName());
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + ", Name: " + output.FirstName + " and the member status is: " + output.MemberStatus);;
                Logger.Info("TestStep: " + stepName + " ##Passed## IpCode:" + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                vc = output.GetLoyaltyCards();

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Deactivating the member whose status is Active";
                //cdis_Service_Method.LockDownMember(vc[0].LoyaltyIdNumber);
                string message = cdis_Service_Method.LockDownMember(vc[0].LoyaltyIdNumber, DateTime.Now, "SOAP_Automation", string.Empty, out elapsedTime);
                Assert.AreEqual("pass", message, "Member with loyalty id: " + vc[0].LoyaltyIdNumber + " has not been locked");
                getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber);
                testStep.SetOutput("Member has been Locked: IPCODE: " + vc[0].IpCode + " and member status is: " + getAccountSummary.MemberStatus);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Deactivating the member whose status is Locked";
                cdis_Service_Method.DeactivateMember(vc[0].LoyaltyIdNumber);
                getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber);
                testStep.SetOutput("IPCODE: " + vc[0].IpCode + " and member status is: " + getAccountSummary.MemberStatus);
                Assert.AreEqual("Locked", getAccountSummary.MemberStatus, "Expected value is Locked and the Actual value is" + getAccountSummary.MemberStatus);
                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);
            }
        }
Пример #16
0
        public void BTA1466_ST1702_SOAP_Regression_ChangeExpirationDate_WithPastDate()
        {
            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 output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Change the Card expiration date";
                IList <VirtualCard> vc          = output.GetLoyaltyCards();
                DateTime            expiredDate = DateTime.Now.AddDays(-2);
                string   response    = cdis_Service_Method.ChangeCardExpirationDate_Negative(vc[0].LoyaltyIdNumber, expiredDate);
                string[] errors      = response.Split(';');
                string[] errorssplit = errors[0].Split('=');
                string[] errorsnew   = errors[1].Split('=');

                testStep.SetOutput(response);
                Logger.Info(response);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validating the error code and the ErrorMessage for the Error Code";
                Assert.AreEqual("1", errorssplit[1], "Expected value is" + "1" + "Actual value is" + errorssplit[1]);
                testStep.SetOutput("The ErrorMessage from Service is: " + errorsnew[1]);
                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 BTA1235_ST1322_SOAP_RedeemMemberCouponByCertNmbr_ReturnAttributeTrue()
        {
            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
            {
                IList <JToken> JsonData = ProjectBasePage.GetJSONData("CommonSqlStatements");
                string         sqlstmt  = (string)JsonData.FirstOrDefault()["Get_CertNumber_From_LWMemberCouponTable_With_EmptyDateRedeemed"];

                Logger.Info("Test Method Started: " + testCase.GetTestCaseName());
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Get a valid certificateNumber from LW_MemberCoupon table";
                string validCertNumber = DatabaseUtility.GetFromSoapDB(string.Empty, string.Empty, string.Empty, "CERTIFICATENMBR", sqlstmt);
                testStep.SetOutput("The valid certNumbr from LW_MemberCoupon table is: " + validCertNumber);
                Logger.Info("The valid certNumbr from LW_MemberCoupon table is: " + validCertNumber);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep       = TestStepHelper.StartTestStep(testStep);
                stepName       = "Redeem the member coupon using certNumber with Return attributes true";
                redemptiondate = System.DateTime.Now;
                bool?returnattributes = true;
                var  certDetails      = cdis_Service_Method.RedeemMemberCouponByCertNumber(validCertNumber, "Web", "en", redemptiondate, timesused, returnattributes, false, string.Empty, out elapsedTime);

                string dbRedemptionDate = DatabaseUtility.GetFromSoapDB("LW_MEMBERCOUPON", "CERTIFICATENMBR", validCertNumber, "DATEREDEEMED", string.Empty);
                Assert.AreEqual(System.DateTime.Now.ToString("MM/dd/yyyy"), Convert.ToDateTime(dbRedemptionDate).ToString("MM/dd/yyyy"), "Expected value is" + System.DateTime.Now.ToString("MM/dd/yyyy") + " and Actual value is" + Convert.ToDateTime(dbRedemptionDate).ToString("MM/dd/yyyy"));
                testStep.SetOutput("The Coupon name from the response of RedeemMemberCouponByCertNumber method is: " + certDetails.CouponDefinition.Name +
                                   "; the redemption date is: " + dbRedemptionDate);
                Logger.Info("TestStep: " + stepName + " ##Passed## The Coupon name from the response of RedeemMemberCouponByCertNumber method is: " + certDetails.CouponDefinition.Name +
                            " and; the redemption date is: " + dbRedemptionDate);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                //unredeem the cert again since we have less certificates
                cdis_Service_Method.UnRedeemMemberCouponByCertNumber(validCertNumber, out elapsedTime);
                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);
                Logger.Info("Test Failed: " + testCase.GetTestCaseName() + "Reason: " + e.Message);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA151_ST965_SOAP_LockDownMember_IpCodeNotExistsInDB_NEGATIVE()

        {
            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 output = cdis_Service_Method.GetCDISMemberGeneral();
                vc = output.GetLoyaltyCards();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Locking down the member by passing an invalid member identity";
                //string error = (string)cdis_Service_Method.LockDownMemberNegative(common.RandomNumber(8));
                string   error       = cdis_Service_Method.LockDownMember(common.RandomNumber(8), DateTime.UtcNow, "CDIS Automation", string.Empty, out elapsedTime);
                string[] errors      = error.Split(';');
                string[] errorssplit = errors[0].Split('=');
                string[] errorsnew   = errors[1].Split('=');
                testStep.SetOutput("Throws an expection with the " + error);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);


                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validating the response for Error Code as 3302";
                Assert.AreEqual("3302", errorssplit[1], "Expected value is" + "3302" + "Actual value is" + errorssplit[1]);
                testStep.SetOutput("The ErrorMessage from Service is: " + errorsnew[1]);
                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);
            }
        }
Пример #19
0
        public void BTA844_ST_CDIS_DeactivateMember_DiasbledMember()
        {
            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);

                Logger.Info("Test Method Started: " + testCase.GetTestCaseName());
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + ", Name: " + output.FirstName + " and the member status is: " + output.MemberStatus);;
                Logger.Info("TestStep: " + stepName + " ##Passed## IpCode:" + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                vc = output.GetLoyaltyCards();

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Deactivating the member whose status is Active";
                cdis_Service_Method.DeactivateMember(vc[0].LoyaltyIdNumber);
                string dbMemberStatus = DatabaseUtility.GetFromSoapDB("LW_LoyaltyMember", "IPCODE", output.IpCode.ToString(), "MemberStatus", string.Empty);
                // getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber);
                testStep.SetOutput("Member has been deactivated: IPCODE: " + vc[0].IpCode + " and member status is: " + (Member_Status)Int32.Parse(dbMemberStatus));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Deactivating the member whose status is Disabled";
                cdis_Service_Method.DeactivateMember(vc[0].LoyaltyIdNumber);
                // getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber);
                string dbMemberStatusNew = DatabaseUtility.GetFromSoapDB("LW_LoyaltyMember", "IPCODE", output.IpCode.ToString(), "MemberStatus", string.Empty);
                testStep.SetOutput("IPCODE: " + vc[0].IpCode + " and member status is: " + (Member_Status)Int32.Parse(dbMemberStatusNew) + "");
                Assert.AreEqual("Disabled", (Member_Status)Int32.Parse(dbMemberStatusNew) + "", "Expected value is Disabled and the Actual value is" + (Member_Status)Int32.Parse(dbMemberStatusNew) + "");
                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);
            }
        }
Пример #20
0
        public void BTA228_CDIS_GetRewardCatalog_PositiveCase()

        {
            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);
            string    RwdID      = string.Empty;
            string    RwdName    = string.Empty;
            ArrayList RewardID   = new ArrayList();
            ArrayList RewardName = new ArrayList();


            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Get Reward Catalog with CDIS service";
                RewardCatalogSummaryStruct[] rewardCatalogs = cdis_Service_Method.GetRewardCatalog();
                foreach (var rewardcatalog in rewardCatalogs)
                {
                    RewardID.Add(rewardcatalog.RewardID);
                    RewardName.Add(rewardcatalog.RewardName);
                }
                RwdID   = string.Join(";", RewardID.ToArray());
                RwdName = string.Join(";", RewardName.ToArray());
                testStep.SetOutput("The RewardID from the reponse are: ;" + RwdID + "; and there corresponding reward names are: ; " + RwdName);
                Logger.Info("RewardID: " + RwdID + " and Reward names are: " + RwdName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validating data with data from database";
                string dbresponse = DatabaseUtility.GetRewardCatalogfromDBUsingIdSOAP(rewardCatalogs[0].RewardID + "");
                Assert.AreEqual(rewardCatalogs[0].RewardID.ToString(), dbresponse, "Expected Value is " + rewardCatalogs[0].RewardID + " Actual Value is " + dbresponse);
                testStep.SetOutput("RewardID from database for the first reward catalog item is : " + dbresponse);
                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.ToString());
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA151_SOAP_LockDownMember_Positive()
        {
            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 output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Lock down the member";
                IList <VirtualCard> vc = output.GetLoyaltyCards();
                //cdis_Service_Method.LockDownMember(vc[0].LoyaltyIdNumber);
                string message = cdis_Service_Method.LockDownMember(vc[0].LoyaltyIdNumber, DateTime.Now, "SOAP_Automation", string.Empty, out elapsedTime);
                Assert.AreEqual("pass", message, "Member with loyalty id: " + vc[0].LoyaltyIdNumber + " has not been locked");
                testStep.SetOutput("Member is Locked");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "validating the card status for lock down member from database";
                String dbresponse = DatabaseUtility.GetMemberStatusfromDbSOAP(output.IpCode + "");
                String value      = (Member_Status)Int32.Parse(dbresponse) + "";
                Assert.AreEqual(Member_Status.Locked.ToString(), value, "Expected value is" + Member_Status.Locked.ToString() + "Actual value is" + value);
                testStep.SetOutput("The card status from database for lockdown is : \"" + dbresponse + "\" and the member status: " + (Member_Status)Int32.Parse(dbresponse));
                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);
            }
        }
Пример #22
0
        public void BTA1476_ST1740_SOAP_GetServiceInfo_ValidateServiceInfo()
        {
            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 = "Get Organization, Environment, Loyalty Ware Assembly Version, Loyalty Ware Schema Version, CDIS Assembly Version and Validate";
                testStep = TestStepHelper.StartTestStep(testStep);
                GetServiceInfoOut services = cdis_Service_Method.GetServiceInfo(out elapsedTime);

                Assert.AreEqual(environment, services.Environment, "Expected environemnt is: " + environment + " and Actual environment is: " + services.Environment);
                Assert.AreEqual(organization, services.Organization, "Expected environemnt is: " + organization + " and Actual environment is: " + services.Organization);
                Assert.AreEqual(loyaltyWareAssemblyVersion, services.LoyaltyWareAssemblyVersion, "Expected environemnt is: " + loyaltyWareAssemblyVersion + " and Actual environment is: " + services.LoyaltyWareAssemblyVersion);
                Assert.AreEqual(loyaltyWareSchemaVersion, services.LoyaltyWareSchemaVersion, "Expected environemnt is: " + loyaltyWareSchemaVersion + " and Actual environment is: " + services.LoyaltyWareSchemaVersion);
                Assert.AreEqual(cdisAssemblyVersion, services.CDISAssemblyVersion, "Expected environemnt is: " + cdisAssemblyVersion + " and Actual environment is: " + services.CDISAssemblyVersion);

                testStep.SetOutput("Service Info data is validated and Info is : " +
                                   "Organization = " + services.Organization + ", " +
                                   "Environment = " + services.Environment + ", " +
                                   "Loyalty Ware Assembly Version = " + services.LoyaltyWareAssemblyVersion + ", " +
                                   "Loyalty Ware Schema version = " + services.LoyaltyWareSchemaVersion + ", " +
                                   "CDIS Assembly Version = " + services.CDISAssemblyVersion);
                Logger.Info("Service Info data is validated and Info is : " +
                            "Organization = " + services.Organization + ", " +
                            "Environment = " + services.Environment + ", " +
                            "Loyalty Ware Assembly Version = " + services.LoyaltyWareAssemblyVersion + ", " +
                            "Loyalty Ware Schema version = " + services.LoyaltyWareSchemaVersion + ", " +
                            "CDIS Assembly Version = " + services.CDISAssemblyVersion);

                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);
            }
        }
Пример #23
0
        public void BTA1467_ST1900_SOAP_DeActivate_ReplacedCard()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName        = "";
            string errorCode       = "3307";
            string expectedMessage = "Virtual card has been replaced.  Its card canot be activated.";

            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 output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Replacing card for the member";
                IList <VirtualCard> vc = output.GetLoyaltyCards();
                Member response        = cdis_Service_Method.ReplaceCard(vc[0].LoyaltyIdNumber, common.RandomNumber(7), true, System.DateTime.Now, out elapsedTime);
                vc = response.GetLoyaltyCards();
                testStep.SetOutput("Member \"" + output.FirstName + "\" card with LoyaltyCardId : " + vc[0].LoyaltyIdNumber + " has been replaced with new LoyaltyCardId: " + vc[1].LoyaltyIdNumber);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Deactivating the card which is Inactive for the member";
                string message = cdis_Service_Method.DeActivateCardUsingLoyaltyID(vc[0].LoyaltyIdNumber, DateTime.Now, "Automation - Deactivate Card");
                Assert.AreEqual(message.Contains(errorCode), true, "Error code " + errorCode + " is not returned when trying to DeActivate the Replaced member");
                Assert.AreEqual(message.Contains(expectedMessage), true, "Message: " + expectedMessage + " is not returned when trying to DeActivate the Replaced member");
                testStep.SetOutput(message);
                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 BTA244_CDIS_GetLoyaltyEvents_PositiveCase()

        {
            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);
                List <string>        activities          = new List <string>();

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Get loyalty Events names from GetLoyalityEvents method";
                LoyaltyEventStruct[] loyaltyEventStruct = cdis_Service_Method.GetLoyalityEvents();
                foreach (var loyaltyEvent in loyaltyEventStruct)
                {
                    activities.Add(loyaltyEvent.Name.ToString());
                }

                testStep.SetOutput("The following are the loyaltyEvent Name's from the GetLoyalityEvents response:; " + string.Join(";", activities.ToArray()));
                Logger.Info("Description of Loyality Currencey:" + loyaltyEventStruct[0].Name + "Points" + loyaltyEventStruct[0].DefaultPoints);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validating loyaltyEvent names in DB";
                List <string> dbresponse = DatabaseUtility.GetLoyaltyEventsfromDBUsingIdSOAP();
                for (int i = 0; i < loyaltyEventStruct.Length; i++)
                {
                    Assert.AreEqual(loyaltyEventStruct[i].Name + "", dbresponse[i], "Expected Value is " + loyaltyEventStruct[i].Name + " Actual Value is " + dbresponse[i]);
                }

                testStep.SetOutput("Total rows Count from database : " + dbresponse.Count + "; and following are the loyaltyevents names from DB:; " + string.Join(";", dbresponse.ToArray()));
                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.ToString());
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
Пример #25
0
        public void BTA844_ST983_CDIS_DeactivateMemberWithUpdateMemberStatusReasonMoreThan250char()
        {
            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
            {
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode);
                Logger.Info("IpCode: " + output.IpCode);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                IList <VirtualCard> vc = output.GetLoyaltyCards();

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Updating Member Status Reason with More Than 250 Characters through Deactivate member method";

                string   StatusReason = common.RandomString(270);
                string   outputnew    = (string)cdis_Service_Method.DeactivateMember_negative(vc[0].LoyaltyIdNumber, StatusReason);
                string[] errors       = outputnew.Split(';');
                string[] errorssplit  = errors[0].Split('=');
                string[] errorsnew    = errors[1].Split('=');
                testStep.SetOutput(outputnew);
                Logger.Info(output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validating the response for Error Code as 2000";
                Assert.AreEqual("2002", errorssplit[1], "Expected value is" + "2002" + "Actual value is" + errorssplit[1]);
                testStep.SetOutput("The ErrorMessage from Service is: " + errorsnew[1]);
                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);
            }
        }
Пример #26
0
        public void BTA844_ST982_CDIS_DeactivateMemberWhoseMemberEntityIsNonMember()
        {
            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);

                Logger.Info("Test Method Started: " + testCase.GetTestCaseName());
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberNonMember();
                testStep.SetOutput("IpCode: " + output.IpCode + ", Name: " + output.FirstName + " and the member status is: " + output.MemberStatus);;
                Logger.Info("TestStep: " + stepName + " ##Passed## IpCode:" + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validate Memberstatus in DB as Non Member";
                string dbMemberStatus = DatabaseUtility.GetFromSoapDB("LW_LoyaltyMember", "IPCODE", output.IpCode.ToString(), "MemberStatus", string.Empty);
                //string dbMemberStatus = DatabaseUtility.GetFromSoapDB("LW_LoyaltyMember", "IPCODE", output.IpCode.ToString(), "NewStatus", string.Empty);
                Assert.AreEqual(Enum.GetName(typeof(Member_Status), Convert.ToInt32(dbMemberStatus)), output.MemberStatus.ToString(), "Expected value is" + Enum.GetName(typeof(Member_Status), Convert.ToInt32(dbMemberStatus)) + "Actual value is" + output.MemberStatus.ToString());
                testStep.SetOutput("The Memberstatus from DB is: " + Enum.GetName(typeof(Member_Status), Convert.ToInt32(dbMemberStatus)) + " and the memberstatus from AddMember method response is: " + output.MemberStatus.ToString());
                Logger.Info("TestStep: " + stepName + " ##Passed## The Memberstatus from DB is: " + Enum.GetName(typeof(Member_Status), Convert.ToInt32(dbMemberStatus)) + " and the memberstatus from AddMember method response is: " + output.MemberStatus.ToString());
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                vc = output.GetLoyaltyCards();

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Deactivating the member whose status is Non Member";
                string outputMsg = (string)cdis_Service_Method.DeactivateMemberWhoseStatusIsNonMember(vc[0].LoyaltyIdNumber);
                testStep.SetOutput(outputMsg);
                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);
            }
        }
Пример #27
0
        public void BTA147_ST1895_SOAP_DeActivatecard_ActiveMember_WithActiveCard()
        {
            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 output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Deactivating card for the member";
                IList <VirtualCard> vc = output.GetLoyaltyCards();
                string message         = cdis_Service_Method.DeActivateCardUsingLoyaltyID(vc[0].LoyaltyIdNumber, DateTime.Now, "Automation - Deactivate Card");
                Assert.AreEqual("pass", message, "Card: " + vc[0].LoyaltyIdNumber + " has been not deactivated");
                testStep.SetOutput("Card is deactivated: " + vc[0].LoyaltyIdNumber);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "validating the response from database";
                string dbresponse = DatabaseUtility.GetLoyaltyCardStatusfromDbSOAP(vc[0].LoyaltyIdNumber);
                testStep.SetOutput("Response from DB: LoyaltyCardId NewStatus is : \"" + dbresponse + "\" which means the card is : " + (LoyaltyCard_Status)Int32.Parse(dbresponse));
                string value = (LoyaltyCard_Status)Int32.Parse(dbresponse) + "";
                Assert.AreEqual(LoyaltyCard_Status.Inactive.ToString(), value, "Expected value is" + LoyaltyCard_Status.Inactive.ToString() + "Actual value is" + value);
                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);
            }
        }
Пример #28
0
        public void BTA841_ST889_SOAP_ActivateMember_TerminatedMember()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            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 output          = cdis_Service_Method.GetCDISMemberGeneral();
                IList <VirtualCard> vc = output.GetLoyaltyCards();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName + "and memberstatus is: " + output.MemberStatus);
                Logger.Info("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Terminating the member";
                //cdis_Service_Method.TerminateMember(vc[0].LoyaltyIdNumber);
                string actualMessage = cdis_Service_Method.TerminateMember(vc[0].LoyaltyIdNumber, DateTime.Now, "SOAP_Automation", String.Empty, out elapsedTime);
                Assert.AreEqual("pass", actualMessage, "Member with loyality id number : " + vc[0].LoyaltyIdNumber + " is not terminated");
                var getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber);
                Assert.AreEqual("Terminated", getAccountSummary.MemberStatus, "Expected value is Terminated and Actual value is" + getAccountSummary.MemberStatus);
                testStep.SetOutput("Member status after TerminateMember call by using GetAccountSummary is : " + getAccountSummary.MemberStatus);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Activate the member by passing member identity of a member whose status is Terminated";
                string outputMsg = cdis_Service_Method.ActivateMemberWithTerminatedStatus(vc[0].LoyaltyIdNumber);
                testStep.SetOutput(outputMsg);
                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);
            }
        }
Пример #29
0
        public void BTA841_ST887_SOAP_ActivateMemberWithMandatoryFieldsForLockedMember()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            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 output          = cdis_Service_Method.GetCDISMemberGeneral();
                IList <VirtualCard> vc = output.GetLoyaltyCards();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Locking the member";
                //cdis_Service_Method.LockDownMember(vc[0].LoyaltyIdNumber);
                string message = cdis_Service_Method.LockDownMember(vc[0].LoyaltyIdNumber, DateTime.Now, "SOAP_Automation", string.Empty, out elapsedTime);
                Assert.AreEqual("pass", message, "Member with loyalty id: " + vc[0].LoyaltyIdNumber + " has not been locked");
                getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber);
                testStep.SetOutput("Member status after DeActivateMember call by using GetAccountSummary is : " + getAccountSummary.MemberStatus + " and the loyalty Id is : " + vc[0].LoyaltyIdNumber);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Activate the member by passing mandatory fields of a member whose status is Locked";
                cdis_Service_Method.ActivateMemberWithMandatoryFields(vc[0].LoyaltyIdNumber);
                getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber);
                testStep.SetOutput("Member status after ActivateMember call by using GetAccountSummary is : " + getAccountSummary.MemberStatus + " and the loyalty Id is : " + vc[0].LoyaltyIdNumber);
                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);
            }
        }
Пример #30
0
        public void BTA1466_ST1698_SOAP_Regression_ChangeExpirationDate_FutureDate()
        {
            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 output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Change the Card expiration date";
                IList <VirtualCard> vc       = output.GetLoyaltyCards();
                DateTime            newDate  = DateTime.Now.AddYears(1);
                DateTime            response = cdis_Service_Method.ChangeCardExpirationDate(vc[0].LoyaltyIdNumber, newDate, out elapsedTime);
                testStep.SetOutput("The LoyaltyCard's: " + vc[0].LoyaltyIdNumber + " new expiration date is : " + response + "Elapsed Time:" + response);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Verify the updated expiration date in the DB";
                string dbresponse = DatabaseUtility.GetExpirationDatefromDbSOAP(vc[0].LoyaltyIdNumber);
                Assert.AreEqual(response + "", dbresponse, "Expected value is" + response + "Actual value is" + dbresponse);
                testStep.SetOutput("The new expiration date from DB is :" + dbresponse);
                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);
            }
        }