コード例 #1
0
        public void CanIssuePointsForSpendUneven()
        {
            string connectionString            = string.Empty;
            int    pointsIssuedPerDollar       = 1;
            int    pointsNeededForDollarCredit = 100;
            long   storeId = -1;
            CustomerPointsManager target = CustomerPointsManager.InstantiateForMemory(pointsIssuedPerDollar, pointsNeededForDollarCredit, storeId);
            Decimal spend    = 43.51m;
            int     expected = 43;
            int     actual;

            actual = target.PointsToIssueForSpend(spend);
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void CanCalculatePointsNeededForSpend()
        {
            string connectionString            = string.Empty;
            int    pointsIssuedPerDollar       = 1;
            int    pointsNeededForDollarCredit = 100;
            long   storeId = -1;
            CustomerPointsManager target = CustomerPointsManager.InstantiateForMemory(pointsIssuedPerDollar, pointsNeededForDollarCredit, storeId);

            Decimal purchaseAmount = 57.83m;
            int     expected       = 5783;
            int     actual;

            actual = target.PointsNeededForPurchaseAmount(purchaseAmount);
            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void CanCalculateDollarValueOfPoints()
        {
            string connectionString            = string.Empty;
            int    pointsIssuedPerDollar       = 1;
            int    pointsNeededForDollarCredit = 100;
            long   storeId = -1;
            CustomerPointsManager target = CustomerPointsManager.InstantiateForMemory(pointsIssuedPerDollar, pointsNeededForDollarCredit, storeId);

            int     points   = 487;
            Decimal expected = 4.87m;
            Decimal actual;

            actual = target.DollarCreditForPoints(points);
            Assert.AreEqual(expected, actual);
        }