public void BTA1465_ST1675_SOAP_CancelCard_NonExistingCard()
        {
            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 = "Cancel a non existing card and validate the Error:3305";
                string invalidCard = common.RandomNumber(7);
                string error       = cdis_Service_Method.CancelCard_Invalid(invalidCard, null, null, false);
                if (error.Contains(" Error code=3305") && error.Contains("Error Message=Unable to find member with card id "))
                {
                    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: 3305. 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);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA1465_ST1676_SOAP_CancelCard_InactiveMember()
        {
            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;

            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 = "Deactivating the member";
                vc       = output.GetLoyaltyCards();
                cdis_Service_Method.DeactivateMember(vc[0].LoyaltyIdNumber);
                testStep.SetOutput("Member is Deactivated");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Cancel card for an Inactive member and validate the Error:3314";
                string error = cdis_Service_Method.CancelCard_Invalid(vc[0].LoyaltyIdNumber, null, null, false);
                if (error.Contains(" Error code=3314") && error.Contains("Error Message=Member is not active"))
                {
                    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: 3314. 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);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA1465_ST1789_SOAP_CancelCard_InactiveCard_And_ActiveMember()
        {
            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 = "Deactivating card for the member";
                //cdis_Service_Method.DeActivateCardUsingLoyaltyID(vc[0].LoyaltyIdNumber);
                string message = cdis_Service_Method.DeActivateCardUsingLoyaltyID(vc[0].LoyaltyIdNumber, DateTime.Now, "Automation - Deactivate Card");
                Assert.AreEqual("pass", message, "Card : " + vc[0].LoyaltyIdNumber + " has not been 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 inactive card status from database";
                string inactiveCardStatus = DatabaseUtility.GetLoyaltyCardStatusfromDbSOAP(vc[0].LoyaltyIdNumber);
                string activeMemberStatus = DatabaseUtility.GetMemberStatusfromDbSOAP(output.IpCode + "");
                string value1             = (Member_Status)Int32.Parse(activeMemberStatus) + "";
                string value = (LoyaltyCard_Status)Int32.Parse(inactiveCardStatus) + "";
                Assert.AreEqual(LoyaltyCard_Status.Inactive.ToString(), value, "Expected value is" + LoyaltyCard_Status.Inactive.ToString() + "Actual value is" + value);
                Assert.AreEqual(Member_Status.Active.ToString(), value1, "Expected value is" + Member_Status.Active.ToString() + "Actual value is" + value1);
                testStep.SetOutput("LoyaltyCardId Status from DB is : \"" + inactiveCardStatus + "\" which means the card is : " + (LoyaltyCard_Status)Int32.Parse(inactiveCardStatus) +
                                   "MemberStatus from DB: " + activeMemberStatus + "   Member Status: " + (Member_Status)Int32.Parse(activeMemberStatus));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);


                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Cancel card for an Inactive member and validate the Error:3307";
                string error = cdis_Service_Method.CancelCard_Invalid(vc[0].LoyaltyIdNumber, null, null, false);
                if (error.Contains(" Error code=3307") && error.Contains("Error Message=Invalid card status"))
                {
                    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: 3307. 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);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }