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); } }