Пример #1
0
        public void BTA1230_ST1388_AwardLoyaltyCurrency_CurrencyAmountZero()
        {
            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());
                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 where currency amount is 0";
                decimal? amount          = 0;
                DateTime expirationdate  = new DateTime(DateTime.Now.Year, 12, 31);
                DateTime?transactiondate = DateTime.Now;
                string   errorMsg        = cdis_Service_Method.AwardLoyaltyCurrencyInvalid(vc[0].LoyaltyIdNumber, LoyaltyEvents.PurchaseActivity, LoyaltyCurrency.BasePoints, amount, transactiondate, expirationdate, "Awarding new amounts", "SOAPService");
                if (errorMsg.Contains("Error code=3313") && errorMsg.Contains("Error Message=0 points were requested.  Loyalty currency canot be 0"))
                {
                    testStep.SetOutput("The Error message from Service is received as expected. " + errorMsg);
                    Logger.Info("The Error message from Service is received as expected. " + errorMsg);
                }
                else
                {
                    throw new Exception("Error not received as expected error: 3362. Actual error received is" + errorMsg);
                }
                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);
            }
        }
Пример #2
0
        public void BTA1230_ST1389_AwardLoyaltyCurrency_InvalidMemberIdentity()
        {
            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          = Convert.ToDecimal(common.RandomNumber(3));
                DateTime expirationdate  = new DateTime(DateTime.Now.Year, 12, 31);
                DateTime?transactiondate = DateTime.Now;
                string   memberIdentity  = common.RandomNumber(7);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Award LoyaltyCurrency to a member using AwardLoyaltyCurrency method where member identity not exists";
                string value = DatabaseUtility.GetFromSoapDB("lw_virtualcard", "LOYALTYIDNUMBER", memberIdentity, "LOYALTYIDNUMBER", string.Empty);
                while (value == memberIdentity)
                {
                    memberIdentity = common.RandomNumber(7);
                    value          = DatabaseUtility.GetFromSoapDB("lw_virtualcard", "LOYALTYIDNUMBER", memberIdentity, "LOYALTYIDNUMBER", string.Empty);
                }
                string errorMsg = cdis_Service_Method.AwardLoyaltyCurrencyInvalid(memberIdentity, LoyaltyEvents.PurchaseActivity, LoyaltyCurrency.BasePoints, amount, transactiondate, expirationdate, "Awarding new amounts", "CDISService");
                if (errorMsg.Contains("Error code=3305") && errorMsg.Contains("Error Message=Unable to find member with loyalty id"))
                {
                    testStep.SetOutput("The Error message from Service is received as expected. " + errorMsg);
                    Logger.Info("The Error message from Service is received as expected. " + errorMsg);
                }
                else
                {
                    throw new Exception("Error not received as expected error: 3362. Actual error received is" + errorMsg);
                }
                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);
            }
        }