public void BTA1230_ST1513_SOAP_AwardLoyaltyCurrency_BlankCurrencyAmount() { 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 = null; DateTime expirationdate = new DateTime(DateTime.Now.Year, 12, 31); DateTime?transactiondate = DateTime.Now; 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 with blank currency amount"; AwardLoyaltyCurrencyOut awardLoyaltyCurrency = cdis_Service_Method.AwardLoyaltyCurrency(vc[0].LoyaltyIdNumber, LoyaltyEvents.PurchaseActivity, LoyaltyCurrency.BasePoints, amount, transactiondate, expirationdate, "Awarding new amounts", "CDISService"); testStep.SetOutput("The LoyaltyCurrencyBalance awarded to the member is: " + awardLoyaltyCurrency.CurrencyBalance.ToString()); Logger.Info("The LoyaltyCurrencyBalance awarded to the member is: " + awardLoyaltyCurrency.CurrencyBalance.ToString()); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Validate the LoyaltyCurrency balance with the currency balance returned by GetAccountSummary method"; var getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); Assert.AreEqual(getAccountSummary.CurrencyBalance, awardLoyaltyCurrency.CurrencyBalance, "Expected value is" + getAccountSummary.CurrencyBalance + "Actual value is" + awardLoyaltyCurrency.CurrencyBalance); testStep.SetOutput("The LoyaltyCurrencyBalance from GetAccountSummary method is: " + getAccountSummary.CurrencyBalance + "" + " and the LoyaltyCurrencyBalance from AwardLoyaltyCurrency method is: " + awardLoyaltyCurrency.CurrencyBalance); Logger.Info("TestStep: " + stepName + " ##Passed## The LoyaltyCurrencyBalance from GetAccountSummary method is: " + getAccountSummary.CurrencyBalance + " and the LoyaltyCurrencyBalance from AwardLoyaltyCurrency method is: " + awardLoyaltyCurrency.CurrencyBalance); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Validate the LoyaltyCurrency balance with DB"; string dbresponse = DatabaseUtility.GetLoyaltyCurrencyBalancesfromDBUsingIdSOAP(vc[0].VcKey + ""); Assert.AreEqual(dbresponse, awardLoyaltyCurrency.CurrencyBalance.ToString(), "Expected value is" + dbresponse + "Actual value is" + awardLoyaltyCurrency.CurrencyBalance.ToString()); testStep.SetOutput("The LoyaltyCurrencyBalance from DB is: " + dbresponse + "" + " and the LoyaltyCurrencyBalance from AwardLoyaltyCurrency method is: " + awardLoyaltyCurrency.CurrencyBalance); Logger.Info("TestStep: " + stepName + " ##Passed## The LoyaltyCurrencyBalance from DB is: " + dbresponse + " and the LoyaltyCurrencyBalance from AwardLoyaltyCurrency method is: " + awardLoyaltyCurrency.CurrencyBalance); 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); } }
//TODO: Need the exact reward name from DB public void BTA1245_ST1781_SOAP_ReturnMemberRewardOrder_OrderNumberExistsPartNumberDoesNotExists() { 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>(); string errorCode = "3355"; string expectedMessage = "Order number not found."; 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"; decimal? amount = 100; DateTime expirationdate = new DateTime(DateTime.Now.Year, 12, 31); DateTime?transactiondate = DateTime.Now; AwardLoyaltyCurrencyOut awardLoyaltyCurrency = cdis_Service_Method.AwardLoyaltyCurrency(vc[0].LoyaltyIdNumber, LoyaltyEvents.PurchaseActivity, LoyaltyCurrency.BasePoints, amount, transactiondate, expirationdate, "Awarding new amounts", "SOAPService"); GetAccountSummaryOut getInitialAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); decimal initialBalance = getInitialAccountSummary.CurrencyBalance; testStep.SetOutput("The LoyaltyCurrencyBalance awarded to the member is: " + awardLoyaltyCurrency.CurrencyBalance.ToString()); Logger.Info("TestStep: " + stepName + " ##Passed## The LoyaltyCurrencyBalance awarded to the member is: " + awardLoyaltyCurrency.CurrencyBalance.ToString()); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Add Members rewards with CDIS service"; RewardCatalogSummaryStruct reward = new RewardCatalogSummaryStruct(); reward.RewardName = DatabaseUtility.GetFromSoapDB("LW_REWARDSDEF", "name", "ZeroBalanceReward", "name", string.Empty); AddMemberRewardsOut memberRewardsOut = (AddMemberRewardsOut)cdis_Service_Method.AddMemberRewards(vc[0].LoyaltyIdNumber, vc[0].LoyaltyIdNumber, reward); testStep.SetOutput("The reward with RewardID:" + memberRewardsOut.MemberRewardID + " has been added to the member with IPCODE: " + output.IpCode); Logger.Info("member RewardID:" + memberRewardsOut.MemberRewardID); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Return member rewards based on the Order number where order number exists and part number does not exists"; string orderNumber = memberRewardsOut.OrderNumber; string message = cdis_Service_Method.ReturnMemberRewardOrder(orderNumber, out elapsedTime); Assert.AreEqual(message.Contains(errorCode), true, "Error code received is different and is : " + errorCode + " for the member with order number: " + orderNumber); Assert.AreEqual(message.Contains(expectedMessage), true, "Error message received is different and is : " + expectedMessage + " for the member with order number: " + orderNumber); testStep.SetOutput("Returned error code: " + errorCode + " and Error message : " + expectedMessage); 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 BTA249_SOAP_CancelMemberReward() { testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); String stepName = ""; double time = 0; try { Logger.Info("Test Method Started"); Common common = new Common(this.DriverContext); CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Adding member with CDIS service"; Member 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 = "Add Award Loyalty Balance"; AwardLoyaltyCurrencyOut loyaltyCurrencyOut = cdis_Service_Method.AwardLoyaltyCurrency(vc[0].LoyaltyIdNumber); testStep.SetOutput("The loyalty currency balance of the member is: " + loyaltyCurrencyOut.CurrencyBalance); Logger.Info("Balance of Account after awarding loyalty currency" + loyaltyCurrencyOut.CurrencyBalance); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Account Activity Summary through GetAccountSummary method"; GetAccountSummaryOut AccountSummaryOutBeforeReward = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); testStep.SetOutput("The loyalty Currency of the member before adding the reward is " + AccountSummaryOutBeforeReward.CurrencyBalance); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Recent Reward Catalog with GetRewardCatalog service"; RewardCatalogSummaryStruct[] rewardCatalog = cdis_Service_Method.GetRecentRewardCatalog(0, 100, 100); RewardCatalogSummaryStruct reward = new RewardCatalogSummaryStruct(); foreach (RewardCatalogSummaryStruct r in rewardCatalog) { if (r.CurrencyToEarn == 100) { reward = r; break; } } testStep.SetOutput("The RewardID from the response of GetRewardCatalog method is : " + reward.RewardID + " and the reward name is: " + reward.RewardName); Logger.Info("RewardID:" + reward.RewardID); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); // IList<VirtualCard> vc = output.GetLoyaltyCards(); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Add Reward to Member using AddMemberRewards service"; AddMemberRewardsOut memberRewardsOut = (AddMemberRewardsOut)cdis_Service_Method.AddMemberRewards(vc[0].LoyaltyIdNumber, vc[0].LoyaltyIdNumber, reward); testStep.SetOutput("The membersRewardID is: " + memberRewardsOut.MemberRewardID); Logger.Info("RewardID:" + memberRewardsOut.MemberRewardID); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Account Activity Summary through GetAccountSummary method"; GetAccountSummaryOut AccountSummaryOutAfterReward = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); testStep.SetOutput("The loyalty Currency of the member after adding reward is " + AccountSummaryOutAfterReward.CurrencyBalance); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Cancelling the member reward with CDIS service"; decimal value = cdis_Service_Method.CancelMemberReward(memberRewardsOut.MemberRewardID + "", out time); testStep.SetOutput("The Loyalty currency balance from the CancelMemberReward response is :" + value); Logger.Info("Value from the service:" + value); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Account Activity Summary through GetAccountSummary method after cancelling the reward"; AccountSummaryOutBeforeReward = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); testStep.SetOutput("The loyalty Currency of the member after cancelling the reward is " + AccountSummaryOutBeforeReward.CurrencyBalance); Assert.AreEqual(AccountSummaryOutBeforeReward.CurrencyBalance, value, "Expected Value is " + AccountSummaryOutBeforeReward.CurrencyBalance + " Actual Value is " + value); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Validating the reward status with data from the DB"; string dbresponse = DatabaseUtility.GetMemberRewardStatusfromDBUsingIdSOAP(output.IpCode + "", reward.RewardID + ""); testStep.SetOutput("The Reward status from database : " + dbresponse); Assert.AreEqual("Cancelled", dbresponse, "Expected Value is " + "Cancelled" + " Actual Value 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 BTA246_CDIS_MergeMembers_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 = "Add First member using AddMember method"; 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> vc1 = output.GetLoyaltyCards(); testStep = TestStepHelper.StartTestStep(testStep); stepName = "AwardLoyaltyCurrency Balance to first member"; AwardLoyaltyCurrencyOut loyaltyCurrencyOut = cdis_Service_Method.AwardLoyaltyCurrency(vc1[0].LoyaltyIdNumber, LoyaltyEvents.PurchaseActivity, LoyaltyCurrency.BasePoints); testStep.SetOutput("Loyalty currency balance for firstMember: " + loyaltyCurrencyOut.CurrencyBalance); Logger.Info("Balance of Account after awarding loyalty currency" + loyaltyCurrencyOut.CurrencyBalance); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Account Summary of first member using GetAccountSummary Method"; GetAccountSummaryOut AccountSummaryOut = cdis_Service_Method.GetAccountSummary(vc1[0].LoyaltyIdNumber); testStep.SetOutput("The following are the details of First Member;" + "Loyalty Currency Balance is: " + AccountSummaryOut.CurrencyBalance + ";Tier: " + AccountSummaryOut.CurrentTierName); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Add second member using AddMember method"; Member outputnew = cdis_Service_Method.GetCDISMemberGeneral(); testStep.SetOutput("IpCode: " + outputnew.IpCode + ", Name: " + outputnew.FirstName); Logger.Info("IpCode: " + outputnew.IpCode + ", Name: " + outputnew.FirstName); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); IList <VirtualCard> vcs = outputnew.GetLoyaltyCards(); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Account Summary of second member using GetAccountSummary Method"; GetAccountSummaryOut AccountSummaryOut1 = cdis_Service_Method.GetAccountSummary(vcs[0].LoyaltyIdNumber); testStep.SetOutput("The following are the details of Second Member;" + "Loyalty Currency Balance is: " + AccountSummaryOut1.CurrencyBalance + ";Tier: " + AccountSummaryOut1.CurrentTierName); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Merging Members through MergeMember method"; Member member = cdis_Service_Method.MergeMembers(vc1[0].LoyaltyIdNumber, vcs[0].LoyaltyIdNumber); testStep.SetOutput("The second member Ipcode: " + member.IpCode + " and member status is: " + member.MemberStatus); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); IList <VirtualCard> vcmerge = member.GetLoyaltyCards(); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Account Summary of the second member after MERGE and verify tier and balance information"; GetAccountSummaryOut AccountSummaryOutmerge = cdis_Service_Method.GetAccountSummary(vcmerge[0].LoyaltyIdNumber); testStep.SetOutput("The following are the details of Second Member after MERGE;" + "Loyalty Currency Balance is: " + AccountSummaryOutmerge.CurrencyBalance + ";Tier: " + AccountSummaryOutmerge.CurrentTierName + "; and Member status is: " + AccountSummaryOutmerge.MemberStatus); Assert.AreEqual(AccountSummaryOut1.MemberStatus, AccountSummaryOutmerge.MemberStatus, "Expected value is" + AccountSummaryOut1.MemberStatus + "Actual value is" + AccountSummaryOutmerge.MemberStatus); Assert.AreEqual((AccountSummaryOut1.CurrencyBalance + AccountSummaryOut.CurrencyBalance), AccountSummaryOutmerge.CurrencyBalance, "Expected value is" + (AccountSummaryOut1.CurrencyBalance + AccountSummaryOut.CurrencyBalance) + "Actual value is" + AccountSummaryOutmerge.CurrencyBalance); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Account Summary of the First member after MERGE and verify tier and balance information"; GetAccountSummaryOut AccountSummaryOutoneaftermerge = cdis_Service_Method.GetAccountSummary(vc1[0].LoyaltyIdNumber); testStep.SetOutput("The following are the details of First Member after MERGE;" + "Loyalty Currency Balance is: " + AccountSummaryOutoneaftermerge.CurrencyBalance + ";Tier: " + AccountSummaryOutoneaftermerge.CurrentTierName + "; and Member status is: " + AccountSummaryOutoneaftermerge.MemberStatus); Assert.AreEqual("Merged", AccountSummaryOutoneaftermerge.MemberStatus, "Expected value is \"Merged\" and Actual value is" + AccountSummaryOutoneaftermerge.MemberStatus); Assert.AreEqual("0", AccountSummaryOutoneaftermerge.CurrencyBalance.ToString(), "Expected value is \"0\" and Actual value is" + AccountSummaryOutoneaftermerge.CurrencyBalance); 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 BTA1241_ST1326_SOAP_CancelMemberReward_InvalidMemberRewardId_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(); 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 = "Add Award Loyalty Balance"; AwardLoyaltyCurrencyOut loyaltyCurrencyOut = cdis_Service_Method.AwardLoyaltyCurrency(vc[0].LoyaltyIdNumber); testStep.SetOutput("The loyalty currency balance of the member is: " + loyaltyCurrencyOut.CurrencyBalance); Logger.Info("Balance of Account after awarding loyalty currency" + loyaltyCurrencyOut.CurrencyBalance); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Account Activity Summary through GetAccountSummary method"; GetAccountSummaryOut AccountSummaryOutBeforeReward = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); testStep.SetOutput("The loyalty Currency of the member before adding the reward is " + AccountSummaryOutBeforeReward.CurrencyBalance); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Recent Reward Catalog with GetRewardCatalog service"; RewardCatalogSummaryStruct[] rewardCatalog = cdis_Service_Method.GetRecentRewardCatalog(0, 100, 100); RewardCatalogSummaryStruct reward = new RewardCatalogSummaryStruct(); foreach (RewardCatalogSummaryStruct r in rewardCatalog) { if (r.CurrencyToEarn == 100) { reward = r; break; } } testStep.SetOutput("The RewardID from the response of GetRewardCatalog method is : " + reward.RewardID + " and the reward name is: " + reward.RewardName); Logger.Info("RewardID:" + reward.RewardID); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Add Reward to Member using AddMemberRewards service"; AddMemberRewardsOut memberRewardsOut = (AddMemberRewardsOut)cdis_Service_Method.AddMemberRewards(vc[0].LoyaltyIdNumber, vc[0].LoyaltyIdNumber, reward); testStep.SetOutput("The membersRewardID is: " + memberRewardsOut.MemberRewardID); Logger.Info("RewardID:" + memberRewardsOut.MemberRewardID); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Account Activity Summary through GetAccountSummary method"; GetAccountSummaryOut AccountSummaryOutAfterReward = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); testStep.SetOutput("The loyalty Currency of the member after adding reward is " + AccountSummaryOutAfterReward.CurrencyBalance); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Cancelling the member reward with CDIS service by providing invalid member reward id"; string error = (string)cdis_Service_Method.CancelMemberRewardNegative(); testStep.SetOutput("Throws an expection with the " + error); string[] errors = error.Split(';'); string[] errorssplit = errors[0].Split('='); 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 3356"; Assert.AreEqual("3356", errorssplit[1], "Expected value is" + "3356" + "Actual value is" + errorssplit[1]); testStep.SetOutput("The ErrorMessage from Service is: " + errors[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.ToString()); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }