コード例 #1
0
        public override MonthlyStatement GenerateStatment(MonthlyUsage monthlyUsage)
        {
            var statement = new MonthlyStatement();

            statement.TotalCost = 54.90f;
            return(statement);
        }
コード例 #2
0
        public override MonthlyStatement GenerateStatment(MonthlyUsage monthlyUsage)
        {
            var statement = new MonthlyStatement();

            statement.CallCost  = 0.12f * monthlyUsage.CallMinutes;
            statement.SmsCost   = 0.12f * monthlyUsage.SmsCount;
            statement.TotalCost = statement.CallCost + statement.SmsCost;
            return(statement);
        }
コード例 #3
0
        public void UnlimitedCustomer_IsChargedAFlatRatePerMonth()
        {
            var customer = new UnlimitedCustomer();
            var usage = new MonthlyUsage { CallMinutes = 100, SmsCount = 100, Customer = customer };
            var statement = usage.Customer.GenerateStatement(usage);

            Assert.AreEqual(0, statement.CallCost);
            Assert.AreEqual(0, statement.SmsCost);
            Assert.AreEqual(54.90f, statement.TotalCost);
        }
コード例 #4
0
        public void PayAsYouGoCustomer_IsChargedBasedOnTheSumOfCostOfCallAndSms()
        {
            var customer = new PayAsYouGoCustomer();
            var usage = new MonthlyUsage { CallMinutes = 100, SmsCount = 100, Customer = customer };
            var statement = usage.Customer.GenerateStatement(usage);

            Assert.AreEqual(12.0f, statement.CallCost);
            Assert.AreEqual(12.0f, statement.SmsCost);
            Assert.AreEqual(24.0f, statement.TotalCost);
        }
コード例 #5
0
        public override MonthlyStatement GenerateStatement(MonthlyUsage monthlyUsage)
        {
            var statement = new MonthlyStatement
            {
                CallCost = 0.12f*monthlyUsage.CallMinutes,
                SmsCost = 0.12f*monthlyUsage.SmsCount
            };

            statement.TotalCost = statement.CallCost + statement.SmsCost;

            return statement;
        }
コード例 #6
0
        public void Generate(MonthlyUsage usage)
        {
            switch (usage.Customer.Type)
            {
            case CustomerType.PayAsYouGo:
                CallCost  = 0.12f * usage.CallMinutes;
                SmsCost   = 0.12f * usage.SmsCount;
                TotalCost = CallCost + SmsCost;
                break;

            case CustomerType.Unlimited:
                TotalCost = 54.90f;
                break;

            default:
                throw new NotSupportedException("The current customer type is not supported");
            }
        }
コード例 #7
0
        public void Generate(MonthlyUsage usage)
        {
            //switch (usage.Customer.Type)
            //{
            //    case CustomerType.PayAsYouGo:
            //        CallCost = 0.12f * usage.CallMinutes;
            //        SmsCost = 0.12f * usage.SmsCount;
            //        TotalCost = CallCost + SmsCost;
            //        break;

            //    case CustomerType.Unlimited:
            //        TotalCost = 54.90f;
            //        break;

            //    default:
            //        throw new NotSupportedException("The current customer type is not supported");
            //}
        }
コード例 #8
0
        public override MonthlyStatement GenerateStatement(MonthlyUsage monthlyUsage)
        {
            var statement = new MonthlyStatement {TotalCost = 54.90f};

            return statement;
        }
コード例 #9
0
 public abstract MonthlyStatement GenerateStatement(MonthlyUsage monthlyUsage);
コード例 #10
0
 public abstract MonthlyStatement GeneratesStatement(MonthlyUsage monthlyUsage);