Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public interface ICustomer

/*
// <SnippetLoyaltyDiscountVersionOne>
// This method belongs in the ICustomer interface (ICustomer.cs)
// Version 1:
public decimal ComputeLoyaltyDiscount()
{
Expand All @@ -26,6 +27,7 @@ public decimal ComputeLoyaltyDiscount()

/*
// <SnippetLoyaltyDiscountVersionTwo>
// These methods belong in the ICustomer interface (ICustomer.cs)
// Version 2:
public static void SetLoyaltyThresholds(
TimeSpan ago,
Expand Down Expand Up @@ -65,6 +67,7 @@ public static void SetLoyaltyThresholds(TimeSpan ago, int minimumOrders, decimal
private static decimal discountPercent = 0.10m;

// <SnippetFinalVersion>
// These methods belong in the ICustomer interface (ICustomer.cs)
public decimal ComputeLoyaltyDiscount() => DefaultLoyaltyDiscount(this);
protected static decimal DefaultLoyaltyDiscount(ICustomer c)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void AddOrder(IOrder order)
}

// <SnippetOverrideAndExtend>
// This method belongs in the SampleCustomer class (SampleCustomer.cs) that implements ICustomer
public decimal ComputeLoyaltyDiscount()
{
if (PreviousOrders.Any() == false)
Expand Down
Loading