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 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); } }
public void BTA1467_ST1897_SOAP_DeActivate_CancelledCard() { testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); String stepName = ""; string errorCode = "3307"; string expectedMessage = "Virtual card has been cancelled. 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 = "Cancelling the card for the member"; IList <VirtualCard> vc = output.GetLoyaltyCards(); cdis_Service_Method.CancelCard(vc[0].LoyaltyIdNumber, 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 = "Deactivating the card which is Cancelled 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 Cancelled card"); Assert.AreEqual(message.Contains(expectedMessage), true, "Message: " + expectedMessage + " is not returned when trying to DeActivate the Cancelled card"); 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 BTA1465_ST1841_SOAP_CancelCard_ActiveCard() { 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 = "Getting an Active card from database"; string loyaltyIdnumber = DatabaseUtility.GetActiveCouponFromDB(); testStep.SetOutput("Active card from database is :" + 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(loyaltyIdnumber, out elapsedtime); testStep.SetOutput("The following card has Canceled :" + 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(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("Card status is validated as cancelled and the card number is " + 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); } }
public void BTA1465_ST1672_SOAP_CancelCard_DeactivateMember() { 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; double elapsedtime; 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 = "Cancel the card and deactivate member"; cdis_Service_Method.CancelCard(vc[0].LoyaltyIdNumber, null, "CDIS Service", true, 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.GetFromSoapDB("lw_virtualcard", "LOYALTYIDNUMBER", vc[0].LoyaltyIdNumber, "STATUS", string.Empty); 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); testStep = TestStepHelper.StartTestStep(testStep); stepName = "validate the member is deactivated"; dbresponse = DatabaseUtility.GetMemberStatusfromDbSOAP(output.IpCode + ""); string value = (Member_Status)Int32.Parse(dbresponse) + ""; Assert.AreEqual(Member_Status.Disabled.ToString(), value, "Expected value is" + Member_Status.Disabled.ToString() + "Actual value is" + value); testStep.SetOutput("The card status from database for lock down 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); } }
public void BTA1465_ST1674_SOAP_CancelCard_CanceledCard() { 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 = "Canceling Card through CancelCard method"; 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 = "Canceling Card which is already Canceled 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); } }