예제 #1
0
        public static void AddRewardPointsHistoryEntry(this Customer customer,
                                                       int points, string message = "",
                                                       Order usedWithOrder        = null, decimal usedAmount = 0M)
        {
            int newPointsBalance = customer.GetRewardPointsBalance() + points;

            var rewardPointsHistory = new RewardPointsHistory()
            {
                Customer      = customer,
                UsedWithOrder = usedWithOrder,
                Points        = points,
                PointsBalance = newPointsBalance,
                UsedAmount    = usedAmount,
                Message       = message,
                CreatedOnUtc  = DateTime.UtcNow
            };

            customer.RewardPointsHistory.Add(rewardPointsHistory);
        }
예제 #2
0
        public void Can_get_rewardPointsHistoryBalance()
        {
            var customer = new Customer();
            customer.AddRewardPointsHistoryEntry(1, "Points for registration");
            //customer.AddRewardPointsHistoryEntry(3, "Points for registration");

            customer.GetRewardPointsBalance().ShouldEqual(1);
        }