public void BTA841_ST862_SOAP_ActivateMemberWithAllFieldsForActiveMember() { 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 + "and Member Status is: " + output.MemberStatus); Logger.Info("IpCode: " + output.IpCode + " , Name: " + output.FirstName + "and Member Status is: " + output.MemberStatus); 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 for a member whose status is Active"; cdis_Service_Method.ActivateMember(vc[0].LoyaltyIdNumber); testStep.SetOutput("Activate member performs no action on active member, Member Status after ActivateMember is: " + output.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 BTA152_SOAP_ActivateMember_Positive() { 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(); 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"; vc = output.GetLoyaltyCards(); //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"); testStep.SetOutput("Member is Locked "); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Activating the member"; cdis_Service_Method.ActivateMember(vc[0].LoyaltyIdNumber); testStep.SetOutput("Member is Reactivated"); 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.GetMemberStatusfromDbSOAP(output.IpCode + ""); testStep.SetOutput("Response from database: " + dbresponse + " Member Status: " + (Member_Status)Int32.Parse(dbresponse)); string value = (Member_Status)Int32.Parse(dbresponse) + ""; Assert.AreEqual(Member_Status.Active.ToString(), value, "Expected value is" + Member_Status.Active.ToString() + "Actual value is" + value); 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_ST885_SOAP_ActivatePreEnrolledMemberWithAllFields() { testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); Common common = new Common(this.DriverContext); CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common); try { Logger.Info("Test Method Started: " + testCase.GetTestCaseName()); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Adding member with CDIS service as Pre Enrolled"; Member output = cdis_Service_Method.GetCDISMemberPreEnrolled(); vc = output.GetLoyaltyCards(); 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); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Validate Memberstatus in DB as Pre-Enrolled"; string dbMemberStatus = DatabaseUtility.GetFromSoapDB("LW_LoyaltyMember", "IPCODE", output.IpCode.ToString(), "MemberStatus", string.Empty); // string dbMemberStatus = DatabaseUtility.GetFromSoapDB("LW_LoyaltyMember", "IPCODE", output.IpCode.ToString(), "NewStatus", string.Empty); Assert.AreEqual(Enum.GetName(typeof(Member_Status), Convert.ToInt32(dbMemberStatus)), output.MemberStatus.ToString(), "Expected value is" + Enum.GetName(typeof(Member_Status), Convert.ToInt32(dbMemberStatus)) + "Actual value is" + output.MemberStatus.ToString()); testStep.SetOutput("The Memberstatus from DB is: " + Enum.GetName(typeof(Member_Status), Convert.ToInt32(dbMemberStatus)) + " and the memberstatus from AddMember method response is: " + output.MemberStatus.ToString()); Logger.Info("TestStep: " + stepName + " ##Passed## The Memberstatus from DB is: " + Enum.GetName(typeof(Member_Status), Convert.ToInt32(dbMemberStatus)) + " and the memberstatus from AddMember method response is: " + output.MemberStatus.ToString()); 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 for a member whose status is Pre-Enrolled"; cdis_Service_Method.ActivateMember(vc[0].LoyaltyIdNumber); var getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber); testStep.SetOutput("Member status after ActivateMember call by using GetAccountSummary is : " + getAccountSummary.MemberStatus); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep); stepName = "validate the member status from database as Active"; string dbresponse = DatabaseUtility.GetMemberStatusfromDbSOAP(output.IpCode + ""); string value = (Member_Status)Int32.Parse(dbresponse) + ""; Assert.AreEqual(Member_Status.Active.ToString(), value, "Expected value is" + Member_Status.Active.ToString() + "Actual value is" + value); testStep.SetOutput("The Member status from database is : " + value); 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); Logger.Info("Test Failed: " + testCase.GetTestCaseName() + "Reason: " + e.Message); Assert.Fail(e.Message.ToString()); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA841_ST886_SOAP_ActivateMemberWithAllFieldsForInactiveMember() { 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 + " 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 Inactive"; 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 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 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); } }