Example #1
0
        public void HertzAwardLoyaltyCurrency_Negative(MemberModel member, string token, int errorCode, string errorMessage, string memLoyaltyID = null)
        {
            MemberController memController = new MemberController(Database, TestStep);

            try
            {
                //Generate unique LIDs for each virtual card in the member
                member = memController.AssignUniqueLIDs(member);

                TestStep.Start($"Make AddMember Call", "Member should be added successfully");
                MemberModel memberOut = memController.AddMember(member);
                AssertModels.AreEqualOnly(member, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());

                var loyaltyId = memLoyaltyID ?? memberOut.VirtualCards.First().LOYALTYIDNUMBER;
                TestStep.Start($"Make HertzValidateToken Call", $"Add member call should throw exception with error code = {errorCode}");
                LWServiceException exception = Assert.Throws <LWServiceException>(() => memController.HertzValidateToken(loyaltyId, token), "Expected LWServiceException, exception was not thrown.");
                Assert.AreEqual(errorCode, exception.ErrorCode);
                Assert.IsTrue(exception.Message.Contains(errorMessage));
                Assert.AreEqual(errorCode, exception.ErrorCode);
                Assert.IsTrue(exception.Message.Contains(errorMessage));
                TestStep.Pass("HertzValidateToken call threw expected exception", exception.ReportDetail());
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
Example #2
0
        public void AddMemberRewards_Negative(MemberModel testMember, IHertzProgram program, int errorCode, string errorMessage)
        {
            MemberController      memController = new MemberController(Database, TestStep);
            TxnHeaderController   txnController = new TxnHeaderController(Database, TestStep);
            List <TxnHeaderModel> txnList       = new List <TxnHeaderModel>();
            int              daysAfterCheckOut  = 1;
            DateTime         checkOutDt         = DateTime.Now;
            DateTime         checkInDt          = checkOutDt.AddDays(daysAfterCheckOut);
            DateTime         origBkDt           = checkOutDt;
            RewardController rewardController   = new RewardController(Database, TestStep);
            RewardDefModel   reward             = rewardController.GetRandomRewardDef(program);
            decimal          points             = Math.Round(Math.Max(0, (reward.HOWMANYPOINTSTOEARN - (reward.HOWMANYPOINTSTOEARN * 0.5M))));
            long             pointeventid       = 6263265;

            try
            {
                TestStep.Start("Assing Member unique LoyaltyIds for each virtual card", "Unique LoyaltyIds should be assigned");
                testMember = memController.AssignUniqueLIDs(testMember);
                TestStep.Pass("Unique LoyaltyIds assigned", testMember.VirtualCards.ReportDetail());

                string loyaltyID   = testMember.VirtualCards[0].LOYALTYIDNUMBER;
                string alternateID = testMember.ALTERNATEID;
                string vckey       = testMember.VirtualCards[0].VCKEY.ToString();

                TestStep.Start($"Make AddMember Call", $"Member with LID {loyaltyID} should be added successfully and member object should be returned");
                MemberModel memberOut = memController.AddMember(testMember);
                AssertModels.AreEqualOnly(testMember, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());

                TestStep.Start($"Make AwardLoyaltyCurrency Call", $"Member should be updated successfully and earn {points} points");
                HertzAwardLoyaltyCurrencyResponseModel currencyOut = memController.HertzAwardLoyaltyCurrency(loyaltyID, "oagwuegbo", points, pointeventid, "Automated Appeasement", null);
                decimal pointsOut = memController.GetPointSumFromDB(loyaltyID);
                Assert.AreEqual(points, pointsOut, "Expected points and pointsOut values to be equal, but the points awarded to the member and the point summary taken from the DB are not equal");
                Assert.AreEqual(currencyOut.CurrencyBalance, points, "Expected point value put into AwardLoyaltyCurrency API Call to be equal to the member's current balance, but the point values are not equal");
                TestStep.Pass("Points are successfully awarded");

                TestStep.Start("Make AddMemberReward Call", "AddMemberReward Call is unsuccessful and throws an exception");
                LWServiceException exception = Assert.Throws <LWServiceException>(() => memController.AddMemberReward(loyaltyID, reward.CERTIFICATETYPECODE, testMember.MemberDetails.A_EARNINGPREFERENCE), "Excepted LWServiceException, exception was not thrown.");
                Assert.AreEqual(errorCode, exception.ErrorCode);
                Assert.IsTrue(exception.Message.Contains(errorMessage));
                TestStep.Pass("AddMemberReward Call is unsuccessful and error codes are validated");
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
Example #3
0
        public void AddMemberPromotion_Positive(MemberModel member, string promotionCode)
        {
            MemberController    memController   = new MemberController(Database, TestStep);
            PromotionController promoController = new PromotionController(Database, TestStep);

            try
            {
                TestStep.Start("Adding Member unique LoyaltyIds for each virtual card", "Unique LoyaltyIds should be assigned");
                member = memController.AssignUniqueLIDs(member);
                TestStep.Pass("Unique LoyaltyIds assigned", member.VirtualCards.ReportDetail());

                string loyaltyID = member.VirtualCards[0].LOYALTYIDNUMBER;
                TestStep.Start($"Make AddMember Call", $"Member with LID {loyaltyID} should be added successfully and member object should be returned");
                MemberModel memberOut = memController.AddMember(member);
                AssertModels.AreEqualOnly(member, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());

                TestStep.Start($"Find promotion in database", "Promotion should be found");
                IEnumerable <PromotionModel> promos = promoController.GetFromDB(code: promotionCode);
                Assert.NotNull(promos, "Expected Promotion.GetFromDB to return IEnumerable<Promotion> object");
                Assert.IsTrue(promos.Any(x => x.CODE.Equals(promotionCode)), "Expected promotion code was not found in database");
                TestStep.Pass("Promotion was found", promos.ReportDetail());

                TestStep.Start($"Make AddMemberPromotion Call", "AddMemberPromotion call should return MemberPromotion object");
                MemberPromotionModel memberPromoOut = memController.AddMemberPromotion(loyaltyID, promotionCode, null, null, false, null, null, false);
                Assert.IsNotNull(memberPromoOut, "Expected populated MemberPromotion object, but MemberPromotion object returned was null");
                TestStep.Pass("MemberPromotion object was returned", memberPromoOut.ReportDetail());

                TestStep.Start($"Verify member promotion exists in {MemberPromotionModel.TableName}", $"Member promotion should be in {MemberPromotionModel.TableName}");
                IEnumerable <MemberPromotionModel> dbMemberPromo = memController.GetMemberPromotionsFromDB(memberPromoOut.ID, promotionCode, memberOut.IPCODE);
                Assert.IsNotNull(dbMemberPromo, "Expected populated MemberPromotion object from database query, but MemberPromotion object returned was null");
                Assert.Greater(dbMemberPromo.Count(), 0, "Expected at least one MemberPromotion to be returned from query");
                AssertModels.AreEqualOnly(memberPromoOut, dbMemberPromo.First(), MemberPromotionModel.BaseVerify);
                TestStep.Pass("MemberPromotion object exists in table", dbMemberPromo.ReportDetail());
            }
            catch (AssertionException ex)
            {
                TestStep.Fail(ex.Message);
                Assert.Fail();
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
Example #4
0
        //[TestCaseSource(typeof(AddMemberRewardsData), "FlashSaleScenarios")]
        public void AddMemberRewards_FlashSale(MemberModel testMember, string[] typeCodes, decimal points, IHertzProgram program)
        {
            MemberController    memController = new MemberController(Database, TestStep);
            TxnHeaderController txnController = new TxnHeaderController(Database, TestStep);
            int      daysAfterCheckOut        = 1;
            DateTime checkOutDt   = new DateTime(2020, 02, 25);
            DateTime checkInDt    = checkOutDt.AddDays(daysAfterCheckOut);
            DateTime origBkDt     = checkOutDt;
            long     pointeventid = 6263265;

            try
            {
                TestStep.Start("Assing Member unique LoyaltyIds for each virtual card", "Unique LoyaltyIds should be assigned");
                testMember = memController.AssignUniqueLIDs(testMember);
                TestStep.Pass("Unique LoyaltyIds assigned", testMember.VirtualCards.ReportDetail());

                string loyaltyID   = testMember.VirtualCards[0].LOYALTYIDNUMBER;
                string alternateID = testMember.ALTERNATEID;
                string vckey       = testMember.VirtualCards[0].VCKEY.ToString();

                TestStep.Start($"Make AddMember Call", $"Member with LID {loyaltyID} should be added successfully and member object should be returned");
                MemberModel memberOut = memController.AddMember(testMember);
                AssertModels.AreEqualOnly(testMember, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());

                TestStep.Start($"Make AwardLoyaltyCurrency Call", $"Member should be updated successfully and earn {points} points");
                HertzAwardLoyaltyCurrencyResponseModel currencyOut = memController.HertzAwardLoyaltyCurrency(loyaltyID, "oagwuegbo", points, pointeventid, "Automated Appeasement", null);
                decimal pointsOut = memController.GetPointSumFromDB(loyaltyID);
                Assert.AreEqual(points, pointsOut, "Expected points and pointsOut values to be equal, but the points awarded to the member and the point summary taken from the DB are not equal");
                Assert.AreEqual(currencyOut.CurrencyBalance, points, "Expected point value put into AwardLoyaltyCurrency API Call to be equal to the member's current balance, but the point values are not equal");
                TestStep.Pass("Points are successfully awarded");

                TestStep.Start("Redeem all the rewards in the list", "Member should be able to redeem all rewards");
                foreach (string certificateTypeCode in typeCodes)
                {
                    AddMemberRewardsResponseModel rewardResponse = memController.AddMemberReward(loyaltyID, certificateTypeCode, testMember.MemberDetails.A_EARNINGPREFERENCE);
                    Assert.IsNotNull(rewardResponse, "Expected populated AddMemberRewardsResponse object from AddMemberRewards call, but AddMemberRewardsResponse object returned was null");
                }
                TestStep.Pass("Member is able to redeem all rewards");
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
        public void GetMembers_Positive()
        {
            MemberController memController = new MemberController(Database, TestStep);

            string[] searchType  = { "CardID" };
            string[] searchValue = { String.Empty };

            try
            {
                TestStep.Start("Get Existing Member from the database", "Existing member should be found");
                MemberModel dbMember = memController.GetRandomFromDB(MemberModel.Status.Active);
                Assert.IsNotNull(dbMember, "Member could not be retrieved from DB");
                TestStep.Pass("Existing member was found", dbMember.ReportDetail());

                searchValue = new string[] { dbMember.VirtualCards.First().LOYALTYIDNUMBER };

                TestStep.Start($"Make GetMembers Call by SearchType = {searchType}, SearchValue = {searchValue}", "GetMembers should return one member");
                IEnumerable <MemberModel> getMembersOut = memController.GetMembers(searchType, searchValue, null, null, String.Empty);
                Assert.AreEqual(1, getMembersOut.Count());
                TestStep.Pass("GetMembers returned one member", getMembersOut.ReportDetail());

                MemberModel getMember = getMembersOut.First();

                TestStep.Start($"Verify GetMembers returned member matches DB Member", "API member should match existing member found from DB");
                AssertModels.AreEqualOnly(dbMember, getMember, MemberModel.BaseVerify);
                TestStep.Pass("API member matches existing member found from DB");

                TestStep.Start($"Verify MemberDetails in {MemberDetailsModel.TableName} table", "Database member details should match API member");
                AssertModels.AreEqualWithAttribute(getMember.MemberDetails, dbMember.MemberDetails);
                TestStep.Pass("API Member details matches member details in database", dbMember.MemberDetails.ReportDetail());

                TestStep.Start($"Verify MemberPreferences in {MemberPreferencesModel.TableName} table", "Database member preferences should match API member");
                AssertModels.AreEqualWithAttribute(getMember.MemberPreferences, dbMember.MemberPreferences);
                TestStep.Pass("API Member preferences created matches member preferences in database", dbMember.MemberPreferences.ReportDetail());
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
        public void HertzTransferPoints_Negative(MemberModel memberSource, MemberModel memberDestination,
                                                 int errorCode, string errorMessage, string points, string csagent, string reasonCode)
        {
            MemberController memController = new MemberController(Database, TestStep);

            try
            {
                MemberModel memberOutSource = null;
                if (memberSource != null)
                {
                    //Generate unique LIDs for each virtual card in the member
                    memberSource = memController.AssignUniqueLIDs(memberSource);
                    TestStep.Start($"Make AddMember Call", "Member should be added successfully");
                    memberOutSource = memController.AddMember(memberSource);
                    AssertModels.AreEqualOnly(memberSource, memberOutSource, MemberModel.BaseVerify);
                    TestStep.Pass("Member was added successfully and member object was returned", memberOutSource.ReportDetail());
                }
                MemberModel memberOutDest = null;
                if (memberDestination != null)
                {
                    memberDestination = memController.AssignUniqueLIDs(memberDestination);
                    TestStep.Start($"Make AddMember Call", "Member should be added successfully");
                    memberOutDest = memController.AddMember(memberDestination);
                    AssertModels.AreEqualOnly(memberDestination, memberOutDest, MemberModel.BaseVerify);
                    TestStep.Pass("Member was added successfully and member object was returned", memberOutDest.ReportDetail());
                }
                var loyaltyIdSource      = memberOutSource?.VirtualCards?.First().LOYALTYIDNUMBER ?? "";
                var loyaltyIdDestination = memberOutDest?.VirtualCards?.First().LOYALTYIDNUMBER ?? "";

                TestStep.Start($"Make HertzTransferPoints Call", $"HertzTransferPoints call should throw exception with error code = {errorCode}");
                LWServiceException exception =
                    Assert.Throws <LWServiceException>(() =>
                                                       memController.HertzTransferPoints(loyaltyIdSource, csagent, points,
                                                                                         loyaltyIdDestination, reasonCode),
                                                       "Expected LWServiceException, exception was not thrown.");
                Assert.AreEqual(errorCode, exception.ErrorCode);
                Assert.IsTrue(exception.Message.Contains(errorMessage));
                TestStep.Pass("HertzTransferPoints call threw expected exception", exception.ReportDetail());
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
Example #7
0
        public void GetMemberRewards_Negative(MemberModel testMember, IHertzProgram program, int errorCode, string errorMessage)
        {
            MemberController      memController = new MemberController(Database, TestStep);
            List <TxnHeaderModel> txnList       = new List <TxnHeaderModel>();
            int              daysAfterCheckOut  = 1;
            DateTime         checkOutDt         = new DateTime(2020, 03, 12);
            DateTime         checkInDt          = checkOutDt.AddDays(daysAfterCheckOut);
            DateTime         origBkDt           = checkOutDt;
            RewardController rewardController   = new RewardController(Database, TestStep);
            RewardDefModel   reward             = rewardController.GetRandomRewardDef(program);
            decimal          points             = reward.HOWMANYPOINTSTOEARN;

            try
            {
                TestStep.Start("Assing Member unique LoyaltyIds for each virtual card", "Unique LoyaltyIds should be assigned");
                testMember = memController.AssignUniqueLIDs(testMember);
                TestStep.Pass("Unique LoyaltyIds assigned", testMember.VirtualCards.ReportDetail());

                string loyaltyID   = testMember.VirtualCards[0].LOYALTYIDNUMBER;
                string alternateID = testMember.ALTERNATEID;
                string vckey       = testMember.VirtualCards[0].VCKEY.ToString();

                TestStep.Start($"Make AddMember Call", $"Member with LID {loyaltyID} should be added successfully and member object should be returned");
                MemberModel memberOut = memController.AddMember(testMember);
                AssertModels.AreEqualOnly(testMember, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());

                TestStep.Start("GetMemberRewards API is Called", "GetMemberRewards API Unsucessfully Returns");
                LWServiceException exception = Assert.Throws <LWServiceException>(() => memController.GetMemberRewards(loyaltyID), "Excepted LWServiceException, exception was not thrown.");
                Assert.AreEqual(errorCode, exception.ErrorCode);
                Assert.IsTrue(exception.Message.Contains(errorMessage));
                TestStep.Pass("GetMemberRewards Return is Validated");
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
        public void AddMember_Positive(MemberModel createMember)
        {
            MemberController memController = new MemberController(Database, TestStep);

            try
            {
                TestStep.Start("Assing Member unique LoyaltyIds for each virtual card", "Unique LoyaltyIds should be assigned");
                createMember = memController.AssignUniqueLIDs(createMember);
                TestStep.Pass("Unique LoyaltyIds assigned", createMember.VirtualCards.ReportDetail());

                TestStep.Start($"Make AddMember Call", "Member should be added successfully and member object should be returned");
                MemberModel memberOut = memController.AddMember(createMember);
                AssertModels.AreEqualOnly(createMember, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());

                TestStep.Start($"Verify Member in {MemberModel.TableName} table", "Database member should match created member");
                MemberModel dbMember = memController.GetFromDB(memberOut.IPCODE);
                AssertModels.AreEqualOnly(createMember, dbMember, MemberModel.BaseVerify);
                TestStep.Pass("Member created matches member in database", dbMember.ReportDetail());

                TestStep.Start($"Verify MemberDetails in {MemberDetailsModel.TableName} table", "Database member details should match created member");
                AssertModels.AreEqualOnly(createMember.MemberDetails, dbMember.MemberDetails, MemberDetailsModel.BaseVerify);
                TestStep.Pass("Member details in database match created member details", dbMember.MemberDetails.ReportDetail());

                TestStep.Start($"Verify MemberPreferences in {MemberPreferencesModel.TableName} table", "Database member preferences should match created member");
                AssertModels.AreEqualWithAttribute(createMember.MemberPreferences, dbMember.MemberPreferences);
                TestStep.Pass("Member preferences created matches member preferences in database", dbMember.MemberPreferences.ReportDetail());

                TestStep.Start($"Verify VirtualCard in {VirtualCardModel.TableName} table", "Database VirtualCard should API member VirtualCard");
                AssertModels.AreEqualWithAttribute(memberOut.VirtualCards.First(), dbMember.VirtualCards.First());
                TestStep.Pass("API Member VirtualCard matches database member VirtualCard", dbMember.VirtualCards.First().ReportDetail());
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
        public void HTZUpdateTier_Negative(MemberModel member,
                                           string newTier, string tierEndDate, string marketingCode, string csAgent,
                                           int errorCode, string errorMessage)
        {
            MemberController memController = new MemberController(Database, TestStep);

            try
            {
                MemberModel memberOut = null;
                if (member != null)
                {
                    //Generate unique LIDs for each virtual card in the member
                    member = memController.AssignUniqueLIDs(member);
                    TestStep.Start($"Make AddMember Call", "Member should be added successfully");
                    memberOut = memController.AddMember(member);
                    AssertModels.AreEqualOnly(member, memberOut, MemberModel.BaseVerify);
                    TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());
                }
                var loyaltyId = memberOut?.VirtualCards?.First().LOYALTYIDNUMBER ?? "";
                var tierCode  = newTier ?? "";

                TestStep.Start($"Make HertzUpdateTier Call", $"HertzUpdateTier call should throw exception with error code = {errorCode}");
                LWServiceException exception =
                    Assert.Throws <LWServiceException>(() =>
                                                       memController.HertzUpdateTier(loyaltyId, csAgent, tierCode, tierEndDate, marketingCode),
                                                       "Expected LWServiceException, exception was not thrown.");
                Assert.AreEqual(errorCode, exception.ErrorCode);
                Assert.IsTrue(exception.Message.Contains(errorMessage));
                TestStep.Pass("HertzUpdateTier call threw expected exception", exception.ReportDetail());
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
Example #10
0
        public void HertzAwardLoyaltyCurrency_Negative(MemberModel member, int errorCode, string errorMessage, decimal points, string csagent, string memLoyaltyID = null, string txnRanum = null, decimal?txnPointEventID = null)
        {
            MemberController memController   = new MemberController(Database, TestStep);
            PointController  pointController = new PointController(Database, TestStep);
            string           pointeventname  = "AwardNotApplied-CSAdjustment";

            try
            {
                //Generate unique LIDs for each virtual card in the member
                member = memController.AssignUniqueLIDs(member);

                TestStep.Start($"Make AddMember Call", "Member should be added successfully");
                MemberModel memberOut = memController.AddMember(member);
                AssertModels.AreEqualOnly(member, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());

                TestStep.Start("Find PointEventId in database", $"PointEventId should be found {pointeventname}");
                IEnumerable <PointEventModel> pointEvent = pointController.GetPointEventIdsFromDb(pointeventname);
                decimal pointEventId = txnPointEventID ?? pointEvent.Select(x => x.POINTEVENTID).First();
                Assert.IsTrue(pointEvent.Any(x => x.NAME.Equals(pointeventname)), "Expected pointevent name was not found in database");
                TestStep.Pass("Pointevent name was found in the Database", pointEvent.ReportDetail());

                var loyaltyId = memLoyaltyID ?? memberOut.VirtualCards.First().LOYALTYIDNUMBER;
                TestStep.Start($"Make HertzAwardLoyaltyCurrency Call", $"Add member call should throw exception with error code = {errorCode}");
                LWServiceException exception = Assert.Throws <LWServiceException>(() => memController.HertzAwardLoyaltyCurrency(loyaltyId, csagent, points, Convert.ToInt64(pointEventId), "automationNeg", txnRanum), "Expected LWServiceException, exception was not thrown.");
                Assert.AreEqual(errorCode, exception.ErrorCode);
                Assert.IsTrue(exception.Message.Contains(errorMessage));
                TestStep.Pass("HertzAwardLoyaltyCurrency call threw expected exception", exception.ReportDetail());
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
Example #11
0
        public void AddAttributeSet_Negative(MemberModel member,
                                             AuctionHeaderModel auctionHeaderRequestModel,
                                             int errorCode, string errorMessage)
        {
            MemberController memController = new MemberController(Database, TestStep);

            try
            {
                //Generate unique LIDs for each virtual card in the member
                member = memController.AssignUniqueLIDs(member);

                TestStep.Start($"Make AddMember Call", "Source Member should be added successfully");
                MemberModel memberOut = memController.AddMember(member);
                AssertModels.AreEqualOnly(member, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Source Member was added successfully and member object was returned", memberOut.ReportDetail());
                VirtualCardModel vc = memberOut.VirtualCards.First();

                TestStep.Start($"Make AddAttributeSet Call", "AddAttributeSet call should return AddAttributeSet object");
                LWServiceException exception =
                    Assert.Throws <LWServiceException>(() =>
                                                       memController.AddAttributeSet(vc, auctionHeaderRequestModel),
                                                       "Expected LWServiceException, exception was not thrown.");
                Assert.AreEqual(errorCode, exception.ErrorCode);
                Assert.IsTrue(exception.Message.Contains(errorMessage));
                TestStep.Pass("AddAttributeSet call threw expected exception", exception.ReportDetail());
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
        public void HertzTransferPoints_Positive(MemberModel memberSource, MemberModel memberDestionation, decimal points, IHertzTier tier, bool useRanum)
        {
            MemberController memController = new MemberController(Database, TestStep);

            try
            {
                //Generate unique LIDs for each virtual card in the member
                memberSource = memController.AssignUniqueLIDs(memberSource);
                string ranum;

                TestStep.Start($"Make AddMember Call", "Source Member should be added successfully");
                MemberModel memberOutSource = memController.AddMember(memberSource);
                AssertModels.AreEqualOnly(memberSource, memberOutSource, MemberModel.BaseVerify);
                TestStep.Pass("Source Member was added successfully and member object was returned", memberOutSource.ReportDetail());
                VirtualCardModel vcSource = memberOutSource.VirtualCards.First();

                memberDestionation = memController.AssignUniqueLIDs(memberDestionation);
                TestStep.Start($"Make AddMember Call", "Destination Member should be added successfully");
                MemberModel memberOutDestination = memController.AddMember(memberDestionation);
                AssertModels.AreEqualOnly(memberDestionation, memberOutDestination, MemberModel.BaseVerify);
                TestStep.Pass("Destination Member was added successfully and member object was returned", memberOutDestination.ReportDetail());
                VirtualCardModel vcDestination = memberOutDestination.VirtualCards.First();


                //Transactions are added to test the API with ranum and also to test the negative points scenario
                TestStep.Start($"Add Transaction to the source member", "Transactions added successfully");
                vcSource.Transactions = TxnHeaderController.GenerateRandomTransactions(vcSource, tier.ParentProgram, 1, 500);
                if (useRanum)
                {
                    ranum = vcSource.Transactions.Select(x => x.A_RANUM).First();
                }
                else
                {
                    ranum = null;
                }
                Assert.IsNotNull(vcSource.Transactions, "Expected populated transaction object, but transaction object returned was null");
                TestStep.Pass("Transaction added to the source member", vcSource.Transactions.ReportDetail());

                TestStep.Start("Update Existing Source Member with added transaction", "Source Member object should be returned from UpdateMember call");
                MemberModel updatedMember = memController.UpdateMember(memberOutSource);
                Assert.IsNotNull(updatedMember, "Expected non null Member object to be returned");
                TestStep.Pass("Member object returned from UpdateMember API call", updatedMember.ReportDetail());


                var loyaltyIdSource      = memberOutSource.VirtualCards.First().LOYALTYIDNUMBER;
                var loyaltyIdDestination = memberOutDestination.VirtualCards.First().LOYALTYIDNUMBER;
                var vckeySource          = memberOutSource.VirtualCards.First().VCKEY.ToString();
                var vckeyDestination     = memberOutDestination.VirtualCards.First().VCKEY.ToString();

                TestStep.Start("Get Account Summary from DB for Source Member", "Account Summary retrieved from DB");
                MemberAccountSummaryModel memberAccountSummaryOutDbSourceInitial = memController.GetMemberAccountSummaryFromDB(vckeySource);
                Assert.IsNotNull(memberAccountSummaryOutDbSourceInitial, "Account Summary could not be retrieved from DB");
                TestStep.Pass("Existing member was found", memberAccountSummaryOutDbSourceInitial.ReportDetail());

                TestStep.Start("Get Account Summary from DB for Destination Member", "Account Summary retrieved from DB");
                MemberAccountSummaryModel memberAccountSummaryOutDbDestinationInitial = memController.GetMemberAccountSummaryFromDB(vckeyDestination);
                Assert.IsNotNull(memberAccountSummaryOutDbDestinationInitial, "Account Summary could not be retrieved from DB");
                TestStep.Pass("Existing member was found", memberAccountSummaryOutDbDestinationInitial.ReportDetail());


                TestStep.Start($"Make HertzTransferPoints Call", "HertzTransferPoints call should return HertzTransferPoints object");
                HertzTransferPointsResponseModel memberTransferPoints = memController.HertzTransferPoints(loyaltyIdSource, "csadmin", points.ToString(),
                                                                                                          loyaltyIdDestination, "automation");
                Assert.IsNotNull(memberTransferPoints, "Expected populated HertzTransferPoints object, but HertzTransferPoints object returned was null");
                TestStep.Pass("HertzTransferPoints object was returned", memberTransferPoints.ReportDetail());

                TestStep.Start($"Verify CurrencyBalance of Source Member was decreased", "CurrencyBalance returned should be correct");
                MemberAccountSummaryModel memberAccountSummaryOutDbSourceFinal = memController.GetMemberAccountSummaryFromDB(vckeySource);
                Assert.IsNotNull(memberAccountSummaryOutDbSourceFinal, "Account Summary could not be retrieved from DB");
                Assert.AreEqual(memberAccountSummaryOutDbSourceInitial.CURRENCYBALANCE - points,
                                memberAccountSummaryOutDbSourceFinal.CURRENCYBALANCE,
                                $"CurrencyBalance wasn't decrease due TransferPoints");
                TestStep.Pass("CurrencyBalance response is as expcted", memberAccountSummaryOutDbSourceFinal.ReportDetail());

                TestStep.Start($"Verify CurrencyBalance of Destination Member was increased", "CurrencyBalance returned should be correct");
                MemberAccountSummaryModel memberAccountSummaryOutDbDestinationFinal = memController.GetMemberAccountSummaryFromDB(vckeyDestination);
                Assert.IsNotNull(memberAccountSummaryOutDbDestinationFinal, "Account Summary could not be retrieved from DB");
                Assert.AreEqual(memberAccountSummaryOutDbDestinationInitial.CURRENCYBALANCE + points,
                                memberAccountSummaryOutDbDestinationFinal.CURRENCYBALANCE,
                                $"CurrencyBalance wasn't decrease due TransferPoints");
                TestStep.Pass("CurrencyBalance response is as expcted", memberAccountSummaryOutDbDestinationFinal.ReportDetail());
            }
            catch (AssertionException ex)
            {
                TestStep.Fail(ex.Message);
                Assert.Fail();
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
Example #13
0
        public void HertzAwardLoyaltyCurrency_Positive(MemberModel member, IHertzTier tier, string pointeventname, decimal points, bool useRanum)
        {
            MemberController memController   = new MemberController(Database, TestStep);
            PointController  pointController = new PointController(Database, TestStep);

            try
            {
                //Generate unique LIDs for each virtual card in the member
                member = memController.AssignUniqueLIDs(member);
                string ranum;

                TestStep.Start($"Make AddMember Call", "Member should be added successfully");
                MemberModel memberOut = memController.AddMember(member);
                AssertModels.AreEqualOnly(member, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());

                VirtualCardModel vc = memberOut.VirtualCards.First();
                //Transactions are added to test the API with ranum and also to test the negative points scenario
                TestStep.Start($"Add Transaction to the member", "Transactions added successfully");
                vc.Transactions = TxnHeaderController.GenerateRandomTransactions(vc, tier.ParentProgram, 1, 200);
                if (useRanum)
                {
                    ranum = vc.Transactions.Select(x => x.A_RANUM).First();
                }
                else
                {
                    ranum = null;
                }
                Assert.IsNotNull(vc.Transactions, "Expected populated transaction object, but transaction object returned was null");
                TestStep.Pass("Transaction added to the member", vc.Transactions.ReportDetail());

                TestStep.Start("Update Existing Member with added transaction", "Member object should be returned from UpdateMember call");
                MemberModel updatedMember = memController.UpdateMember(memberOut);
                Assert.IsNotNull(updatedMember, "Expected non null Member object to be returned");
                TestStep.Pass("Member object returned from UpdateMember API call", updatedMember.ReportDetail());

                TestStep.Start("Find PointEventId in database", $"PointEventId should be found {pointeventname}");
                IEnumerable <PointEventModel> pointEvent = pointController.GetPointEventIdsFromDb(pointeventname);
                decimal pointEventId = pointEvent.Select(x => x.POINTEVENTID).First();
                Assert.IsTrue(pointEvent.Any(x => x.NAME.Equals(pointeventname)), "Expected pointevent name was not found in database");
                TestStep.Pass("Pointevent name was found in the Database", pointEvent.ReportDetail());

                var loyaltyId = memberOut.VirtualCards.First().LOYALTYIDNUMBER;
                TestStep.Start($"Make HertzAwardLoyaltyCurrency Call", "HertzAwardLoyaltyCurrency call should return HertzAwardLoyaltyCurrency object");
                HertzAwardLoyaltyCurrencyResponseModel memberAwardLoyaltyCurrency = memController.HertzAwardLoyaltyCurrency(loyaltyId, "csadmin", points, Convert.ToInt64(pointEventId), "automation", ranum);
                Assert.IsNotNull(memberAwardLoyaltyCurrency, "Expected populated AwardLoyaltyCurrency object, but AwardLoyaltyCurrency object returned was null");
                TestStep.Pass("HertzAwardLoyaltyCurrency object was returned", memberAwardLoyaltyCurrency.ReportDetail());

                var vckey = memberOut.VirtualCards.First().VCKEY.ToString();
                TestStep.Start("Get Account Summary from DB", "Account Summary retrieved from DB");
                MemberAccountSummaryModel memberAccountSummaryOutDb = memController.GetMemberAccountSummaryFromDB(vckey);
                Assert.IsNotNull(memberAccountSummaryOutDb, "Account Summary could not be retrieved from DB");
                TestStep.Pass("Existing member was found", memberAccountSummaryOutDb.ReportDetail());

                TestStep.Start("Verify Points awarded matches the points in DB", "Points awarded matches the points in DB");
                IEnumerable <PointTransactionModel> dbPointTransaction = pointController.GetPointTransactionsFromDb(decimal.Parse(vckey)).ToList();
                Assert.IsNotNull(dbPointTransaction, "Expected populated PointTransaction object from database query, but PointTransaction object returned was null");
                Assert.AreEqual(points, dbPointTransaction.Where(x => x.POINTEVENTID == pointEventId && x.POINTS == points).Select(x => x.POINTS).First(), $"Points awarded does not match database points{dbPointTransaction.Select(x => x.POINTS)} ");
                TestStep.Pass("Points awarded are added to the DB", dbPointTransaction.ReportDetail());

                TestStep.Start($"Verify CurrencyBalance of HertzAwardLoyaltyCurrency", "CurrencyBalance returned should be correct");
                Assert.AreEqual(dbPointTransaction.Sum(x => x.POINTS), memberAwardLoyaltyCurrency.CURRENCYBALANCE, $"CurrencyBalance does not match database points{dbPointTransaction.Select(x => x.POINTS)} ");
                Assert.AreEqual(0, memberAwardLoyaltyCurrency.CURRENCYTONEXTTIER, "CurrencyToNextTier does not match 0");
                TestStep.Pass("CurrencyBalance response is as expcted", memberAwardLoyaltyCurrency.ReportDetail());

                TestStep.Start("Compare Account Summary between DB and API", "Account Summary matches");
                AssertModels.AreEqualWithAttribute(memberAccountSummaryOutDb, memberAwardLoyaltyCurrency);
                TestStep.Pass("Account Summary matches between DB and API", memberAccountSummaryOutDb.ReportDetail());

                TestStep.Start($"Verify response of HertzAwardLoyaltyCurrency for GPR", "Response returned should be correct");
                if (tier.ParentProgram.EarningPreference == "N1")
                {
                    Assert.AreEqual(tier.RentalsToNextTier - vc.Transactions.Count(), memberAwardLoyaltyCurrency.RENTALSTONEXTTIER, $"RentalsToNextTier does not match {tier.RentalsToNextTier - vc.Transactions.Count()}");
                    Assert.AreEqual(tier.RevenueToNextTier - vc.Transactions.First().A_GRSREVNAMT, memberAwardLoyaltyCurrency.REVENUETONEXTTIER, $"RentalsToNextTier does not match {tier.RevenueToNextTier - vc.Transactions.First().A_GRSREVNAMT}");
                    Assert.AreEqual(vc.Transactions.Count(), memberAwardLoyaltyCurrency.TOTALRENTALSYTD, $"TotalRentalsYTD does not match {memberAwardLoyaltyCurrency.TOTALRENTALSYTD}");
                    Assert.AreEqual(vc.Transactions.Sum(x => x.A_GRSREVNAMT), memberAwardLoyaltyCurrency.TOTALREVENUEYTD, $"TotalRentalsYTD does not match {memberAwardLoyaltyCurrency.TOTALREVENUEYTD}");
                    Assert.AreEqual("Gold", memberAwardLoyaltyCurrency.CURRENTTIERNAME, $"CurrentTierName does not match {memberAwardLoyaltyCurrency.CURRENCYBALANCE}");
                }
                TestStep.Pass("HertzAwardLoyaltyCurrency response is as expcted for GPR", memberAwardLoyaltyCurrency.ReportDetail());
            }
            catch (AssertionException ex)
            {
                TestStep.Fail(ex.Message);
                Assert.Fail();
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
Example #14
0
        public void UpdateMember_Positive(long memberStatus, IHertzTier hertzTier, int transactionCount)
        {
            MemberController    memController = new MemberController(Database, TestStep);
            TxnHeaderController txnController = new TxnHeaderController(Database, TestStep);

            try
            {
                TestStep.Start("Get Existing Member from the database", "Existing member should be found");
                MemberModel member = memController.GetRandomFromDB(MemberModel.Status.Active, hertzTier);
                member.CHANGEDBY = "UpdateMemberAutomation";
                Assert.IsNotNull(member, "Member could not be retrieved from DB");
                Assert.IsNotNull(member.VirtualCards, "Expected member to have virtual cards");
                TestStep.Pass("Existing member was found", member.ReportDetail());

                var memVirtualCard = member.VirtualCards.First();

                TestStep.Start($"Add {transactionCount} random transaction(s) to members virtual card with VCKEY = {memVirtualCard.VCKEY}", "Transaction(s) should be added to members virtual card");
                memVirtualCard.Transactions = TxnHeaderController.GenerateRandomTransactions(memVirtualCard, hertzTier.ParentProgram, transactionCount, 500M);
                Assert.AreEqual(transactionCount, memVirtualCard.Transactions.Count, $"Expected {transactionCount} TxnHeader(s) to be present in members vitual card");
                TestStep.Pass("Transaction(s) is added to members virtual card", memVirtualCard.Transactions.ReportDetail());

                foreach (var transaction in memVirtualCard.Transactions)
                {
                    transaction.A_TXNQUALPURCHASEAMT = TxnHeaderController.CalculateQualifyingPurchaseAmount(transaction);
                    transaction.A_QUALTOTAMT         = TxnHeaderController.CalculateQualifyingPurchaseAmount(transaction);
                }

                TestStep.Start("Update Existing Member with added transaction", "Member object should be returned from UpdateMember call");
                MemberModel updatedMember = memController.UpdateMember(member);
                Assert.IsNotNull(updatedMember, "Expected non null Member object to be returned");
                TestStep.Pass("Member object returned from UpdateMember API call", updatedMember.ReportDetail());

                TestStep.Start($"Verify API response contains expected Member", "API response should contain passed member.");
                AssertModels.AreEqualOnly(member, updatedMember, MemberModel.BaseVerify);
                TestStep.Pass("API response member matches expected member.");

                TestStep.Start($"Verify API response contains expected MemberDetails for passed member", "API response should contain passed member details.");
                AssertModels.AreEqualWithAttribute(member.MemberDetails, updatedMember.MemberDetails);
                TestStep.Pass("API response contains passed member details.");

                TestStep.Start($"Verify API response contains expected MemberPreferences for passed member", "API response should contain passed member preferences.");
                AssertModels.AreEqualWithAttribute(member.MemberPreferences, updatedMember.MemberPreferences);
                TestStep.Pass("API response contains passed member preferences.");

                TestStep.Start($"Verify API response contains expected VirtualCard for passed member", "API response should contain passed virtual card details.");
                AssertModels.AreEqualWithAttribute(memVirtualCard, updatedMember.VirtualCards.First());
                TestStep.Pass("API response contains passed virtual card.", updatedMember.VirtualCards.ReportDetail());

                TestStep.Start($"Verify Updated Member contains {transactionCount} transaction(s)", $"Members virtual card should contain {transactionCount} transaction(s)");
                Assert.AreEqual(transactionCount, updatedMember.VirtualCards.First().Transactions.Count);
                TestStep.Pass("Members virtual card contained the expected number of transactions");

                foreach (var transaction in memVirtualCard.Transactions)
                {
                    TestStep.Start($"Verify Update Member API response contains transaction RANUM [{transaction.A_RANUM}]", "Update Member API response should contain expected transaction");
                    var updateMemTransaction = updatedMember.VirtualCards.First().Transactions.Find(x => x.A_RANUM == transaction.A_RANUM);
                    Assert.NotNull(updateMemTransaction, $"Transaction with RANUM [{transaction.A_RANUM}] not found in members virtual card");
                    AssertModels.AreEqualWithAttribute(transaction, updateMemTransaction);
                    TestStep.Pass("Members virtual card contains expected transaction", updateMemTransaction.ReportDetail());

                    TestStep.Start($"Verify transaction details are in {TxnHeaderModel.TableName} for A_VCKEY = {memVirtualCard.VCKEY}, A_RANUM = {transaction.A_RANUM}", "Transaction header should be found");
                    IEnumerable <TxnHeaderModel> dbTransactions = txnController.GetFromDB(memVirtualCard.VCKEY, transaction.A_RANUM);
                    Assert.IsNotNull(dbTransactions, "No transactions returned from the database");
                    Assert.AreEqual(1, dbTransactions.Count());
                    AssertModels.AreEqualWithAttribute(transaction, dbTransactions.First());
                    TestStep.Pass("Transaction header was found in database", dbTransactions.First().ReportDetail());
                }
            }
            catch (AssertionException ex)
            {
                TestStep.Fail(ex.Message);
                Assert.Fail();
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new string[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.Message}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message, ex.StackTrace);
                Assert.Fail();
            }
        }
Example #15
0
        public void GetAccountSummaryTestsTest_Positive(MemberModel createMember, IHertzProgram program)
        {
            MemberController memController = new MemberController(Database, TestStep);

            try
            {
                TestStep.Start("Assing Member unique LoyaltyIds for each virtual card", "Unique LoyaltyIds should be assigned");
                createMember = memController.AssignUniqueLIDs(createMember);
                TestStep.Pass("Unique LoyaltyIds assigned", createMember.VirtualCards.ReportDetail());

                TestStep.Start($"Make AddMember Call", "Member should be added successfully and member object should be returned");
                MemberModel memberOut = memController.AddMember(createMember);
                AssertModels.AreEqualOnly(createMember, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());

                int transactionCount = 1;
                var memVirtualCard   = memberOut.VirtualCards.First();
                TestStep.Start($"Add random transaction(s) to members virtual card with VCKEY = {memVirtualCard.VCKEY}", "Transaction(s) should be added to members virtual card");
                memVirtualCard.Transactions = TxnHeaderController.GenerateRandomTransactions(memVirtualCard, program, transactionCount, 500M);
                Assert.AreEqual(transactionCount, memVirtualCard.Transactions.Count, $"Expected {transactionCount} TxnHeader(s) to be present in members vitual card");
                TestStep.Pass("Transaction(s) is added to members virtual card", memVirtualCard.Transactions.ReportDetail());

                foreach (var transaction in memVirtualCard.Transactions)
                {
                    transaction.A_TXNQUALPURCHASEAMT = TxnHeaderController.CalculateQualifyingPurchaseAmount(transaction);
                    transaction.A_QUALTOTAMT         = TxnHeaderController.CalculateQualifyingPurchaseAmount(transaction);
                }

                TestStep.Start("Update Existing Member with added transaction", "Member object should be returned from UpdateMember call");
                MemberModel updatedMember = memController.UpdateMember(memberOut);
                Assert.IsNotNull(updatedMember, "Expected non null Member object to be returned");
                TestStep.Pass("Member object returned from UpdateMember API call", updatedMember.ReportDetail());

                var vckey = memVirtualCard.VCKEY.ToString();
                TestStep.Start("Get Account Summary from DB", "Account Summary retrieved from DB");
                MemberAccountSummaryModel memberAccountSummaryOutDb = memController.GetMemberAccountSummaryFromDB(vckey);
                Assert.IsNotNull(memberAccountSummaryOutDb, "Account Summary could not be retrieved from DB");
                TestStep.Pass("Existing member was found", memberOut.ReportDetail());

                var loyaltyId   = memVirtualCard.LOYALTYIDNUMBER;
                var programCode = program != null ? program.EarningPreference : null;
                TestStep.Start("GetAccountSummary API call", "Account Summary retruned from API");
                MemberAccountSummaryModel memberAccountSummaryOut = memController.GetAccountSummary(loyaltyId, programCode, null);
                Assert.IsNotNull(memberAccountSummaryOut, "Account Summary not returned from API");
                TestStep.Pass("Account Summary was returned from API", memberOut.ReportDetail());

                TestStep.Start("Compare Account Summary between DB and API", "Account Summary matches");
                AssertModels.AreEqualWithAttribute(memberAccountSummaryOutDb, memberAccountSummaryOut);
                TestStep.Pass("Account Summary matches between DB and API", memberOut.ReportDetail());
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
        public void GetMemberPromotion_Positive(MemberModel createMember, string promotionCode)
        {
            MemberController    memController   = new MemberController(Database, TestStep);
            PromotionController promoController = new PromotionController(Database, TestStep);

            try
            {
                TestStep.Start("Assing Member unique LoyaltyIds for each virtual card", "Unique LoyaltyIds should be assigned");
                createMember = memController.AssignUniqueLIDs(createMember);
                TestStep.Pass("Unique LoyaltyIds assigned", createMember.VirtualCards.ReportDetail());

                TestStep.Start($"Make AddMember Call", "Member should be added successfully and member object should be returned");
                MemberModel memberOut = memController.AddMember(createMember);
                AssertModels.AreEqualOnly(createMember, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());

                TestStep.Start("Find promotion in database", "Promotion should be found");
                IEnumerable <PromotionModel> promos = promoController.GetFromDB(code: promotionCode);
                Assert.NotNull(promos, "Expected Promotion.GetFromDB to return IEnumerable<Promotion> object");
                Assert.IsTrue(promos.Any(x => x.CODE.Equals(promotionCode)), "Expected promotion code was not found in database");
                TestStep.Pass("Promotion was found", promos.ReportDetail());

                var loyaltyId = memberOut.VirtualCards.First().LOYALTYIDNUMBER;
                TestStep.Start("Make AddMemberPromotion Call", "AddMemberPromotion call should return MemberPromotion object");
                MemberPromotionModel memberPromoOut = memController.AddMemberPromotion(loyaltyId, promotionCode, null, null, false, null, null, false);
                Assert.IsNotNull(memberPromoOut, "Expected populated MemberPromotion object, but MemberPromotion object returned was null");
                TestStep.Pass("MemberPromotion object was returned", memberPromoOut.ReportDetail());

                TestStep.Start($"Verify added member promotion exists in {MemberPromotionModel.TableName}", $"Member promotion should be in {MemberPromotionModel.TableName}");
                IEnumerable <MemberPromotionModel> dbMemberPromo = memController.GetMemberPromotionsFromDB(null, null, memberOut.IPCODE);
                Assert.IsNotNull(dbMemberPromo, "Expected populated MemberPromotion object from database query, but MemberPromotion object returned was null");
                Assert.Greater(dbMemberPromo.Count(), 0, "Expected at least one MemberPromotion to be returned from query");
                AssertModels.AreEqualOnly(memberPromoOut, dbMemberPromo.OrderByDescending(x => x.CREATEDATE).First(), MemberPromotionModel.BaseVerify);
                TestStep.Pass("MemberPromotion object exists in table", dbMemberPromo.ReportDetail());

                TestStep.Start("Make GetMemberPromotion call", "Member promotion should be returned");
                IEnumerable <MemberPromotionModel> memberPromotionModelOut = memController.GetMemberPromotion(loyaltyId, null, null, false, string.Empty, string.Empty, false, null);
                Assert.Greater(memberPromotionModelOut.Count(), 0, "Expected at least one MemberPromotion to be returned from API");
                TestStep.Pass("MemberPromotion object was returned from API", memberPromotionModelOut.ReportDetail());

                TestStep.Start("Compare Member Promotion Count", "Member promotion count from API should match count from DB");
                Assert.AreEqual(memberPromotionModelOut.Count(), dbMemberPromo.Count(), "Expected Member Promotion count to match");
                TestStep.Pass("MemberPromotion count match completed");

                TestStep.Start($"Verify Member Promotion  in {MemberPromotionModel.TableName} table", "Member Promo from API GetMemberPromotion");
                AssertModels.AreEqualWithAttribute(memberPromotionModelOut, dbMemberPromo);
                TestStep.Pass("API Member promotion created matches member promotions in database", memberOut.MemberPreferences.ReportDetail());
            }
            catch (AssertionException ex)
            {
                TestStep.Fail(ex.Message);
                Assert.Fail();
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
Example #17
0
        public void GetMemberRewards_Positive(MemberModel testMember, IHertzProgram program)
        {
            MemberController      memController = new MemberController(Database, TestStep);
            List <TxnHeaderModel> txnList       = new List <TxnHeaderModel>();
            int              daysAfterCheckOut  = 1;
            DateTime         checkOutDt         = new DateTime(2020, 03, 12);
            DateTime         checkInDt          = checkOutDt.AddDays(daysAfterCheckOut);
            DateTime         origBkDt           = checkOutDt;
            RewardController rewardController   = new RewardController(Database, TestStep);
            RewardDefModel   reward             = rewardController.GetRandomRewardDef(program);
            decimal          points             = reward.HOWMANYPOINTSTOEARN;

            try
            {
                TestStep.Start("Assing Member unique LoyaltyIds for each virtual card", "Unique LoyaltyIds should be assigned");
                testMember = memController.AssignUniqueLIDs(testMember);
                TestStep.Pass("Unique LoyaltyIds assigned", testMember.VirtualCards.ReportDetail());

                string loyaltyID   = testMember.VirtualCards[0].LOYALTYIDNUMBER;
                string alternateID = testMember.ALTERNATEID;
                string vckey       = testMember.VirtualCards[0].VCKEY.ToString();

                TestStep.Start($"Make AddMember Call", $"Member with LID {loyaltyID} should be added successfully and member object should be returned");
                MemberModel memberOut = memController.AddMember(testMember);
                AssertModels.AreEqualOnly(testMember, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());

                TestStep.Start($"Make AwardLoyaltyCurrency Call", $"Member should be updated successfully and earn {points} points");
                AwardLoyaltyCurrencyResponseModel currencyOut = memController.AwardLoyaltyCurrency(loyaltyID, points);
                decimal pointsOut = memController.GetPointSumFromDB(loyaltyID);
                Assert.AreEqual(points, pointsOut, "Expected points and pointsOut values to be equal, but the points awarded to the member and the point summary taken from the DB are not equal");
                Assert.AreEqual(currencyOut.CurrencyBalance, points, "Expected point value put into AwardLoyaltyCurrency API Call to be equal to the member's current balance, but the point values are not equal");
                TestStep.Pass("Points are successfully awarded");

                TestStep.Start("Make AddMemberReward Call", "AddMemberReward Call is successfully made");
                AddMemberRewardsResponseModel rewardResponse = memController.AddMemberReward(loyaltyID, reward.CERTIFICATETYPECODE, testMember.MemberDetails.A_EARNINGPREFERENCE);
                Assert.IsNotNull(rewardResponse, "Expected populated AddMemberRewardsResponse object from AddMemberRewards call, but AddMemberRewardsResponse object returned was null");
                TestStep.Pass("Reward is added.");

                TestStep.Start("Validate that Member has Reward in DB", "Member is found with Reward");
                IEnumerable <MemberRewardsModel> membersRewardOut = memController.GetMemberRewardsFromDB(memberOut.IPCODE, null);
                Assert.IsNotNull(membersRewardOut, "Expected populated MemberRewards object from query, but MemberRewards object returned was null");
                //Assert.Greater(membersRewardOut.Count(), 0, "Expected at least one MemberReward to be returned from query");
                TestStep.Pass("Member Reward Found");

                TestStep.Start("GetMemberRewards API is Called", "GetMemberRewards API Sucessfully Returns");
                List <GetMemberRewardsResponseModel> getMROut = memController.GetMemberRewards(loyaltyID);
                Assert.AreEqual(membersRewardOut.Count(), getMROut.Count);
                TestStep.Pass("GetMemberRewards Return is Validated");
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
Example #18
0
        public void MultiThreadingTestsPositive(MemberModel member1, MemberModel member2)
        {
            MemberController      memController = new MemberController(Database, TestStep);
            List <TxnHeaderModel> txnList1      = new List <TxnHeaderModel>();
            List <TxnHeaderModel> txnList2      = new List <TxnHeaderModel>();

            int           daysAfterCheckOut = 1;
            DateTime      checkOutDt        = DateTime.Now;
            DateTime      checkInDt         = checkOutDt.AddDays(daysAfterCheckOut);
            DateTime      origBkDt          = checkOutDt;
            IHertzProgram program           = HertzLoyalty.GoldPointsRewards;
            decimal       points            = 10;

            try
            {
                TestStep.Start("Assign Members unique LoyaltyIds for each virtual card", "Unique LoyaltyIds should be assigned");
                member1 = memController.AssignUniqueLIDs(member1);
                member2 = memController.AssignUniqueLIDs(member2);
                TestStep.Pass("Unique LoyaltyIds assigned", member1.VirtualCards.ReportDetail());

                TestStep.Start($"Make AddMember Call", "Member should be added successfully and member object should be returned");
                MemberModel memberOut1 = memController.AddMember(member1);
                AssertModels.AreEqualOnly(member1, memberOut1, MemberModel.BaseVerify);
                TestStep.Pass("Member was added successfully and member object was returned", memberOut1.ReportDetail());

                TestStep.Start($"Make AddMember Call", "Member should be added successfully and member object should be returned");
                MemberModel memberOut2 = memController.AddMember(member2);
                AssertModels.AreEqualOnly(member2, memberOut2, MemberModel.BaseVerify);
                TestStep.Pass("Member was added successfully and member object was returned", memberOut1.ReportDetail());

                string  loyaltyID1 = member1.VirtualCards[0].LOYALTYIDNUMBER;
                string  loyaltyID2 = member2.VirtualCards[0].LOYALTYIDNUMBER;
                decimal?cdp        = null;
                for (int x = 0; x < 50; x++)
                {
                    TestStep.Start($"Make UpdateMember Call", $"Members {loyaltyID1} and {loyaltyID2} should be updated successfully and earn {points} points");
                    TxnHeaderModel txn1 = TxnHeaderController.GenerateTransaction(loyaltyID1, checkInDt, checkOutDt, origBkDt, cdp, program, null, "US", points, null, null, "N", "US", null);
                    txnList1.Add(txn1);
                    member1.VirtualCards[0].Transactions = txnList1;
                    TxnHeaderModel txn2 = TxnHeaderController.GenerateTransaction(loyaltyID2, checkInDt, checkOutDt, origBkDt, cdp, program, null, "US", points, null, null, "N", "US", null);
                    txnList2.Add(txn2);
                    member2.VirtualCards[0].Transactions = txnList2;

                    MemberModel updatedMember  = memController.UpdateMember(member1);
                    MemberModel updatedMember2 = memController.UpdateMember(member2);
                    txnList1.Clear();
                    txnList2.Clear();
                    TestStep.Pass("Member was successfully updated");
                }
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
        public void CancelMemberReward_Positive(MemberModel createMember, IHertzProgram program)
        {
            MemberController      memberController = new MemberController(Database, TestStep);
            TxnHeaderController   txnController    = new TxnHeaderController(Database, TestStep);
            List <TxnHeaderModel> txnList          = new List <TxnHeaderModel>();
            int              daysAfterCheckOut     = 1;
            DateTime         checkOutDt            = new DateTime(2020, 01, 31);
            DateTime         checkInDt             = checkOutDt.AddDays(daysAfterCheckOut);
            DateTime         origBkDt         = checkOutDt;
            RewardController rewardController = new RewardController(Database, TestStep);
            RewardDefModel   reward           = rewardController.GetRandomRewardDef(program);
            decimal          points           = reward.HOWMANYPOINTSTOEARN;
            decimal          pointsOutDb      = 0;

            try
            {
                TestStep.Start("Adding Member unique LoyaltyIds for each virtual card", "Unique LoyaltyIds should be assigned");
                createMember = memberController.AssignUniqueLIDs(createMember);
                TestStep.Pass("Unique LoyaltyIds assigned", createMember.VirtualCards.ReportDetail());

                string loyaltyID   = createMember.VirtualCards[0].LOYALTYIDNUMBER;
                string alternateID = createMember.ALTERNATEID;
                string vckey       = createMember.VirtualCards[0].VCKEY.ToString();

                TestStep.Start($"Make AddMember Call", $"Member with LID {loyaltyID} should be added successfully and member object should be returned");
                MemberModel memberOut = memberController.AddMember(createMember);
                AssertModels.AreEqualOnly(createMember, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());

                if (program.EarningPreference == HertzLoyalty.GoldPointsRewards.EarningPreference)
                {
                    TestStep.Start($"Make UpdateMember Call", $"Member should be updated successfully and earn {points} points");
                    TxnHeaderModel txn = TxnHeaderController.GenerateTransaction(loyaltyID, checkInDt, checkOutDt, origBkDt, null, program, null, "US", points, null, null, "N", "US", null);
                    txnList.Add(txn);
                    createMember.VirtualCards[0].Transactions = txnList;
                    MemberModel updatedMember = memberController.UpdateMember(createMember);
                    txnList.Clear();
                    Assert.IsNotNull(updatedMember, "Expected non null Member object to be returned");
                    TestStep.Pass("Member was successfully updated");
                }
                else //Dollar and Thrifty Members Cannot be updated with the UpdateMember API so we use the HertzAwardLoyatlyCurrency API instead
                {
                    TestStep.Start($"Make AwardLoyaltyCurrency Call", $"Member should be updated successfully and earn {points} points");
                    AwardLoyaltyCurrencyResponseModel currencyOut = memberController.AwardLoyaltyCurrency(loyaltyID, points);
                    pointsOutDb = memberController.GetPointSumFromDB(loyaltyID);
                    Assert.AreEqual(points, pointsOutDb, "Expected points and pointsOut values to be equal, but the points awarded to the member and the point summary taken from the DB are not equal");
                    Assert.AreEqual(currencyOut.CurrencyBalance, points, "Expected point value put into AwardLoyaltyCurrency API Call to be equal to the member's current balance, but the point values are not equal");
                    TestStep.Pass("Points are successfully awarded");
                }

                TestStep.Start("Make AddMemberReward Call", "AddMemberReward Call is successfully made");
                AddMemberRewardsResponseModel rewardResponse = memberController.AddMemberReward(loyaltyID, reward.CERTIFICATETYPECODE, createMember.MemberDetails.A_EARNINGPREFERENCE);
                Assert.IsNotNull(rewardResponse, "Expected populated AddMemberRewardsResponse object from AddMemberRewards call, but AddMemberRewardsResponse object returned was null");
                TestStep.Pass("Reward is added.");

                TestStep.Start("Validate that Member has Reward", "Member is found with Reward");
                IEnumerable <MemberRewardsModel> membersRewardOut = memberController.GetMemberRewardsFromDB(memberOut.IPCODE, rewardResponse.MemberRewardID);
                Assert.IsNotNull(membersRewardOut, "Expected populated MemberRewards object from query, but MemberRewards object returned was null");
                Assert.Greater(membersRewardOut.Count(), 0, "Expected at least one MemberReward to be returned from query");
                TestStep.Pass("Member Reward Found");

                var memberRewardId = rewardResponse.MemberRewardID.ToString();
                TestStep.Start("Call CancelMemberreward API", "Member reward is cancelled");
                var currencyBalance = memberController.CancelMemberReward(memberRewardId, null, null, null, null, null, null, null);
                Assert.IsNotNull(currencyBalance, "Expected Member Point Balance");
                TestStep.Pass("Successfully cancelled member reward");

                TestStep.Start("Get Total points from PointTransaction table in DB", "Expected Total points for the member");
                pointsOutDb = memberController.GetPointSumFromDB(loyaltyID);
                Assert.IsNotNull(pointsOutDb, "Expected non null point value");
                Assert.AreEqual(currencyBalance, pointsOutDb, "Expected API Point Balance after cancellation to be equal to sum of points from DB");
                TestStep.Pass("Point successfully credited to member");
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
Example #20
0
        public void AddAttributeSet_Positive(MemberModel member,
                                             AuctionHeaderModel auctionHeaderRequestModel,
                                             IHertzTier tier, bool useRanum)
        {
            MemberController memController = new MemberController(Database, TestStep);

            try
            {
                //Generate unique LIDs for each virtual card in the member
                member = memController.AssignUniqueLIDs(member);
                string ranum;

                TestStep.Start($"Make AddMember Call", "Source Member should be added successfully");
                MemberModel memberOut = memController.AddMember(member);
                AssertModels.AreEqualOnly(member, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Source Member was added successfully and member object was returned", memberOut.ReportDetail());
                VirtualCardModel vc = memberOut.VirtualCards.First();

                //Transactions are added to test the API with ranum and also to test the negative points scenario
                TestStep.Start($"Add Transaction to the source member", "Transactions added successfully");
                vc.Transactions = TxnHeaderController.GenerateRandomTransactions(vc, tier.ParentProgram, 1, 500);
                if (useRanum)
                {
                    ranum = vc.Transactions.Select(x => x.A_RANUM).First();
                }
                else
                {
                    ranum = null;
                }
                Assert.IsNotNull(vc.Transactions, "Expected populated transaction object, but transaction object returned was null");
                TestStep.Pass("Transaction added to the source member", vc.Transactions.ReportDetail());

                TestStep.Start("Update Existing Source Member with added transaction", "Source Member object should be returned from UpdateMember call");
                MemberModel updatedMember = memController.UpdateMember(memberOut);
                Assert.IsNotNull(updatedMember, "Expected non null Member object to be returned");
                TestStep.Pass("Member object returned from UpdateMember API call", updatedMember.ReportDetail());

                TestStep.Start($"Make AddAttributeSet Call", "AddAttributeSet call should return AddAttributeSet object");
                AddAttributeSetResponseModel addAttributeSetResponseModel = memController.AddAttributeSet(vc, auctionHeaderRequestModel);
                Assert.IsNotNull(addAttributeSetResponseModel, "Expected populated AddAttributeSetResponseModel object, but AddAttributeSetResponseModel object returned was null");
                Assert.IsNotNull(addAttributeSetResponseModel.EarnedPoints, "Expected populated EarnedPoints list object, but it was null");
                TestStep.Pass("AddAttributeSetResponseModel object was returned", addAttributeSetResponseModel.EarnedPoints.ReportDetail());

                TestStep.Start($"Verify AuctionHeader ", "AuctionHeader returned should be correct");
                Assert.AreNotEqual(0, addAttributeSetResponseModel.EarnedPoints.Count);
                Assert.AreEqual(auctionHeaderRequestModel.HeaderGPRpts, Math.Abs(addAttributeSetResponseModel.EarnedPoints.FirstOrDefault().PointValue));
                TestStep.Pass("AuctionHeader response is as expcted", addAttributeSetResponseModel.EarnedPoints.ReportDetail());
            }
            catch (AssertionException ex)
            {
                TestStep.Fail(ex.Message);
                Assert.Fail();
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
Example #21
0
        public void AddMemberPromotion_Negative(string loyaltyId, string promoCode, int errorCode, string errorMessage)
        {
            MemberController    memController   = new MemberController(Database, TestStep);
            PromotionController promoController = new PromotionController(Database, TestStep);

            try
            {
                if (!string.IsNullOrEmpty(promoCode) && promoCode.Equals("0000"))
                {
                    TestStep.Start("Adding Member unique LoyaltyIds for each virtual card", "Unique LoyaltyIds should be assigned");
                    MemberModel createMember = MemberController.GenerateRandomMember(HertzLoyalty.GoldPointsRewards.RegularGold);
                    createMember = memController.AssignUniqueLIDs(createMember);
                    TestStep.Pass("Unique LoyaltyIds assigned", createMember.VirtualCards.ReportDetail());

                    loyaltyId = createMember.VirtualCards[0].LOYALTYIDNUMBER;
                    TestStep.Start($"Make AddMember Call", $"Member with LID {loyaltyId} should be added successfully and member object should be returned");
                    MemberModel memberOut = memController.AddMember(createMember);
                    AssertModels.AreEqualOnly(createMember, memberOut, MemberModel.BaseVerify);
                    TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());

                    loyaltyId = memberOut.VirtualCards.First().LOYALTYIDNUMBER;
                }
                else if (promoCode == string.Empty)
                {
                    TestStep.Start("Get Expired promotion from DB", "Expired promo found in DB");
                    IEnumerable <PromotionModel> promoOutDb = promoController.GetRandomExpiredPromotionFromDB();
                    Assert.Greater(promoOutDb.Count(), 0, "Expected one or more expired promotions from DB");
                    TestStep.Pass("Expired promotion found in DB", promoOutDb.ReportDetail());

                    promoCode    = promoOutDb.First().CODE;
                    errorMessage = $"Promotion {promoCode} is not valid anymore";

                    TestStep.Start("Adding Member unique LoyaltyIds for each virtual card", "Unique LoyaltyIds should be assigned");
                    MemberModel createMember = MemberController.GenerateRandomMember(HertzLoyalty.GoldPointsRewards.RegularGold);
                    createMember = memController.AssignUniqueLIDs(createMember);
                    TestStep.Pass("Unique LoyaltyIds assigned", createMember.VirtualCards.ReportDetail());

                    loyaltyId = createMember.VirtualCards[0].LOYALTYIDNUMBER;
                    TestStep.Start($"Make AddMember Call", $"Member with LID {loyaltyId} should be added successfully and member object should be returned");
                    MemberModel memberOut = memController.AddMember(createMember);
                    AssertModels.AreEqualOnly(createMember, memberOut, MemberModel.BaseVerify);
                    TestStep.Pass("Member was added successfully and member object was returned", memberOut.ReportDetail());
                }

                TestStep.Start("Make AddMemberPromotion Call", $"AddMemberPromotion call should throw exception with error code = {errorCode}");
                LWServiceException exception = Assert.Throws <LWServiceException>(() => memController.AddMemberPromotion(loyaltyId, promoCode, null, null, null, null, null, null),
                                                                                  "Expected LWServiceException, exception was not thrown.");
                Assert.AreEqual(errorCode, exception.ErrorCode, $"Expected Error Code: {errorCode}");
                Assert.IsTrue(exception.Message.Contains(errorMessage), $"Expected Error Message to contain: {errorMessage}");
                TestStep.Pass("AddMemberPromotion call threw expected exception", exception.ReportDetail());
            }
            catch (AssertionException ex)
            {
                TestStep.Fail(ex.Message);
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }
        public void HTZUpdateTier_Positive(MemberModel member,
                                           IHertzTier newTier, DateTime newTierEndDate, string newMarketingCode, string csAgent)
        {
            MemberController memController = new MemberController(Database, TestStep);

            try
            {
                //Generate unique LIDs for each virtual card in the member
                member = memController.AssignUniqueLIDs(member);
                TestStep.Start($"Make AddMember Call", "Source Member should be added successfully");
                MemberModel memberOut = memController.AddMember(member);
                AssertModels.AreEqualOnly(member, memberOut, MemberModel.BaseVerify);
                TestStep.Pass("Source Member was added successfully and member object was returned", memberOut.ReportDetail());
                VirtualCardModel vcSource = memberOut.VirtualCards.First();

                var loyaltyId = memberOut.VirtualCards.First().LOYALTYIDNUMBER;
                var vckey     = memberOut.VirtualCards.First().VCKEY.ToString();

                TestStep.Start($"Make HertzUpdateTier Call", "HertzUpdateTier call should return HertzUpdateTierResponse object");
                HertzUpdateTierResponseModel memberUpdateTier = memController.HertzUpdateTier(loyaltyId,
                                                                                              csAgent, newTier.Code, newTierEndDate.ToString("MM/dd/yyyy"), newMarketingCode);
                Assert.IsNotNull(memberUpdateTier, "Expected populated HertzUpdateTierResponseModel object, but HertzUpdateTierResponseModel object returned was null");
                TestStep.Pass("HertzUpdateTierResponseModel object was returned", memberUpdateTier.ReportDetail());

                var tierCodeResponse = string.Empty;
                switch (memberUpdateTier.CURRENTTIERNAME)
                {
                case "Platinum Select": tierCodeResponse = "PS";  break;

                case "Platinum VIP": tierCodeResponse = "VP"; break;

                case "Gold": tierCodeResponse = "RG"; break;

                case "Five Star": tierCodeResponse = "FG"; break;

                case "Presidents Circle": tierCodeResponse = "PC"; break;

                case "Platinum": tierCodeResponse = "PL"; break;
                }

                TestStep.Start($"Verify New Tier values", "New Tier values returned should be correct");
                Assert.IsNotEmpty(tierCodeResponse);
                Assert.AreEqual(newTier.Code.ToUpper(), tierCodeResponse);
                Assert.IsNotNull(memberUpdateTier.A_TIERENDDATE);
                Assert.AreEqual(newTierEndDate.ToString("yyyy-MM-dd"), ((DateTime)memberUpdateTier.A_TIERENDDATE).ToString("yyyy-MM-dd"));
                Assert.AreEqual(newMarketingCode.ToUpper(), memberUpdateTier.A_MKTGPROGRAMID.ToUpper());
                TestStep.Pass("New Tier values response is as expcted", memberUpdateTier.ReportDetail());
            }
            catch (AssertionException ex)
            {
                TestStep.Fail(ex.Message);
                Assert.Fail();
            }
            catch (LWServiceException ex)
            {
                TestStep.Fail(ex.Message, new[] { $"Error Code: {ex.ErrorCode}", $"Error Message: {ex.ErrorMessage}" });
                Assert.Fail();
            }
            catch (AssertModelEqualityException ex)
            {
                TestStep.Fail(ex.Message, ex.ComparisonFailures);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                TestStep.Abort(ex.Message);
                Assert.Fail();
            }
        }