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); } }
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); } }
public void BTA844_ST980_CDIS_DeactivatingMembereWhoseStatusIsTerminated() { 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(); 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 = "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"); getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); testStep.SetOutput("Member has been Terminated: 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); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Deactivate the member by passing member identity of a member whose status is Terminated"; string outputMsg = cdis_Service_Method.DeactivateMemberWithTerminatedStatus(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); } }
public void BTA841_ST887_SOAP_ActivateMemberWithMandatoryFieldsForInactiveMember() { 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 = "Inactivating the member"; cdis_Service_Method.DeactivateMember(vc[0].LoyaltyIdNumber); // getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); string dbMemberStatus = DatabaseUtility.GetFromSoapDB("LW_LoyaltyMember", "IPCODE", output.IpCode.ToString(), "MemberStatus", string.Empty); testStep.SetOutput("Member status after DeActivateMember call by using GetAccountSummary is : " + dbMemberStatus); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Activate the member by passing mandatory fileds of a member whose status is Inactive"; cdis_Service_Method.ActivateMemberWithMandatoryFields(vc[0].LoyaltyIdNumber); getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); Assert.AreEqual("Active", getAccountSummary.MemberStatus, "Expected value is Active and Actual value is" + getAccountSummary.MemberStatus); testStep.SetOutput("Member is Reactivated and Loyalty Id is : " + vc[0].LoyaltyIdNumber + "and his member status is:" + getAccountSummary.MemberStatus); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testCase.SetStatus(true); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Validate Memberstatus as Active in DB "; string value = DatabaseUtility.GetFromSoapDB("LW_LoyaltyMember", "IPCODE", output.IpCode.ToString(), "MemberStatus", string.Empty); string dbMemberStatusNew = (Member_Status)Int32.Parse(value) + ""; Assert.AreEqual(Member_Status.Active.ToString(), dbMemberStatusNew, "Expected value is" + Member_Status.Active.ToString() + "Actual value is" + dbMemberStatusNew); testStep.SetOutput("Member staus is in Active in database"); 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 BTA841_ST886_SOAP_ActivateMemberWithAllFieldsForLockedMember() { 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 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 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 all the fields (Required and Optional) of a member whose status is Locked"; cdis_Service_Method.ActivateMember(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 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 = "Validate Memberstatus and updated member status reason in DB "; string value = DatabaseUtility.GetFromSoapDB("LW_LoyaltyMember", "IPCODE", output.IpCode.ToString(), "MemberStatus", string.Empty); string statusChangeReason = DatabaseUtility.GetFromSoapDB("LW_LoyaltyMember", "IPCODE", output.IpCode.ToString(), "STATUSCHANGEREASON", string.Empty); Assert.AreEqual("SOAP_Automation", statusChangeReason, "status change reason is updated as expected" + statusChangeReason); string dbMemberStatus = (Member_Status)Int32.Parse(value) + ""; Assert.AreEqual(Member_Status.Active.ToString(), dbMemberStatus, "Expected value is" + Member_Status.Active.ToString() + "Actual value is" + dbMemberStatus); testStep.SetOutput("Member staus is in Active and Status change reason is updated successfully in database and the reason is " + statusChangeReason); 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 BTA1466_ST1701_SOAP_Regression_ChangeExpirationDate_WithTransactionPointStatus() { 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 = "Updating Member by adding transactions"; DateTime date = DateTime.Now.AddMilliseconds(1000); string txnHeaderId = cdis_Service_Method.UpdateMember_AddTransactionRequiredDate(output, date); testStep.SetOutput("The transaction header of the transcation posted through udpatemember method is " + txnHeaderId); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Account Summary through Service"; GetAccountSummaryOut AccountSummaryOut = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); testStep.SetOutput("The currencybalance for the member is: " + AccountSummaryOut.CurrencyBalance); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Change the Card expiration date"; DateTime expiredDate = DateTime.Now.AddMilliseconds(1000); DateTime response = cdis_Service_Method.ChangeCardExpirationDate(vc[0].LoyaltyIdNumber, expiredDate, out elapsedTime); testStep.SetOutput("The LoyaltyCard's: " + vc[0].LoyaltyIdNumber + " new expiration date is : " + response); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Account Summary through Service"; GetAccountSummaryOut AccountSummaryOut1 = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); testStep.SetOutput("The currencybalance for the member is: " + AccountSummaryOut1.CurrencyBalance); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Verifying the Currency Balance of the Card"; Assert.AreEqual("0", AccountSummaryOut1.CurrencyBalance.ToString(), "Expected value is :0", "Actual value is" + AccountSummaryOut1.CurrencyBalance.ToString()); testStep.SetOutput("The Currency Balance of the Card :" + AccountSummaryOut1.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); } }
//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 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 BTA844_ST_CDIS_DeActivateMemberWithDeActivateActivecardsAsFalse() { 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 the member"; IList <VirtualCard> vc = output.GetLoyaltyCards(); cdis_Service_Method.DeactivateMember_negative(vc[0].LoyaltyIdNumber, false); getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); testStep.SetOutput("Member has been deactivated: 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 = "validating the Card status for Deactivated member from database"; // string dbresponse = DatabaseUtility.GetLoyaltyCardStatusfromDbSOAP(vc[0].LoyaltyIdNumber); string dbresponse = DatabaseUtility.GetFromSoapDB("lW_VIRTUALCARD", "LOYALTYIDNUMBER", vc[0].LoyaltyIdNumber, "NEWSTATUS", string.Empty); if (string.Empty == dbresponse) { dbresponse = DatabaseUtility.GetFromSoapDB("lW_VIRTUALCARD", "LOYALTYIDNUMBER", vc[0].LoyaltyIdNumber, "STATUS", string.Empty); } string value = (Enums.LoyaltyCard_Status)Int32.Parse(dbresponse) + ""; Assert.AreEqual(Enums.LoyaltyCard_Status.Cancelled.ToString(), value, "Expected value is" + Enums.LoyaltyCard_Status.Cancelled.ToString() + "Actual value is" + value); testStep.SetOutput("The cardstatus code from database for disabled member with deaactivateactivecards as false is : " + dbresponse + " and card status is: " + LoyaltyCard_Status.Cancelled.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 BTA844_ST981_CDIS_DeactivateMemberWhoseStatusIsMerged() { 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 = "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> vc2 = outputnew.GetLoyaltyCards(); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Merging Members through MergeMember method"; Member member = cdis_Service_Method.MergeMembers(vc1[0].LoyaltyIdNumber, vc2[0].LoyaltyIdNumber); getAccountSummary = cdis_Service_Method.GetAccountSummary(vc1[0].LoyaltyIdNumber); testStep.SetOutput("Member has been Merged: IPCODE: " + vc1[0].IpCode + " member status is: " + getAccountSummary.MemberStatus + " and the loyalty id is " + vc1[0].LoyaltyIdNumber); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Deactivate the member by passing member identity of a member whose status is Merged"; string outputMsg = cdis_Service_Method.DeactivateMemberWhoseStatusIsMerged(vc1[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); } }
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 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); } }
public void BTA240_CDIS_GetAccountSummary_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 = "Adding points to members by posting transactions using UpdateMember method"; DateTime date = DateTime.Now.AddDays(-5); var txnHeader = cdis_Service_Method.UpdateMember_PostTransactionRequiredDate(output, date); testStep.SetOutput("The transaction header of the ID is " + txnHeader.TxnHeaderId + "and transaction amount is: " + txnHeader.TxnAmount); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get memberTier through Service"; MemberTierStruct[] memberTier = cdis_Service_Method.GetMemberTier(vc[0].LoyaltyIdNumber); testStep.SetOutput("The members tierName using GetMemberTier Method is " + memberTier[0].TierDef.Name); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Account Summary through Service"; GetAccountSummaryOut AccountSummaryOut = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); testStep.SetOutput("The currencybalance for the member is: " + AccountSummaryOut.CurrencyBalance); //added 5 because of welcome reward which is given to customer when he joins as per rule Assert.AreEqual((txnHeader.TxnAmount + 5).ToString(), AccountSummaryOut.CurrencyBalance.ToString(), "Expected value is" + (txnHeader.TxnAmount + 5).ToString() + "Actual value is" + AccountSummaryOut.CurrencyBalance.ToString()); 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.GetLoyaltyCurrencyBalancesfromDBUsingIdSOAP(vc[0].VcKey + ""); Assert.AreEqual(AccountSummaryOut.CurrencyBalance + "", dbresponse, "Expected value is" + AccountSummaryOut.CurrencyBalance + "Actual value is" + dbresponse); Assert.AreEqual(output.MemberStatus.ToString(), AccountSummaryOut.MemberStatus, "Expected value is" + output.MemberStatus.ToString() + " and actual value is" + AccountSummaryOut.MemberStatus); Assert.AreEqual(memberTier[0].TierDef.Name, AccountSummaryOut.CurrentTierName, "Expected value is" + memberTier[0].TierDef.Name + "Actual value is" + AccountSummaryOut.CurrentTierName); testStep.SetOutput("The following are member details which have been verfiied" + ";Loyalty Currency: " + AccountSummaryOut.CurrencyBalance + ";Member status: " + AccountSummaryOut.MemberStatus + ";and MemberTier: " + AccountSummaryOut.CurrentTierName); 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); } }