public override MonthlyStatement GenerateStatment(MonthlyUsage monthlyUsage) { var statement = new MonthlyStatement(); statement.TotalCost = 54.90f; return(statement); }
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); }
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); }
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); }
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; }
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"); } }
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"); //} }
public override MonthlyStatement GenerateStatement(MonthlyUsage monthlyUsage) { var statement = new MonthlyStatement {TotalCost = 54.90f}; return statement; }
public abstract MonthlyStatement GenerateStatement(MonthlyUsage monthlyUsage);
public abstract MonthlyStatement GeneratesStatement(MonthlyUsage monthlyUsage);