Permalink
Browse files

Fix Law of Demeter violation regarding `Movie.Title`

  • Loading branch information...
rdeneau committed Aug 26, 2018
1 parent ec46c62 commit 8b222b8c457669f0fd921e4cbcf3d791f94a061a
@@ -5,6 +5,8 @@ public class Rental
public int DaysRented { get; }
public Movie Movie { get; }

public string Title => Movie.Title;

public Rental(Movie movie, int daysRented)
{
Movie = movie;
@@ -97,7 +97,7 @@ private static int DetermineFrequentRenterPoints(Rental rental)
}

private static string FormatRentalLine(Rental rental, decimal rentalAmount) =>
FormatLine($"\t{rental.Movie.Title}\t{rentalAmount:0.0}");
FormatLine($"\t{rental.Title}\t{rentalAmount:0.0}");

private string Footer() =>
FormatLine($"You owed {TotalAmount:0.0}") +

0 comments on commit 8b222b8

Please sign in to comment.