Skip to content

code-review-1#1

Open
HerrNiklasRaab wants to merge 1 commit into
masterfrom
code-review-1
Open

code-review-1#1
HerrNiklasRaab wants to merge 1 commit into
masterfrom
code-review-1

Conversation

@HerrNiklasRaab
Copy link
Copy Markdown
Contributor

No description provided.

Comment on lines +52 to 72
public class FrequentRenterPoints
{
public Rental Rental { get; set; }
public FrequentRenterPoints(Rental rental)
{
this.Rental = rental;
}

public Movie getMovie () {
return movie;
public int GetEarnedPoints()
{
if (EligibleForBonusPoints()) { return 2; }
return 1;
}

public int getDaysRented () {
return daysRented;
public bool EligibleForBonusPoints()
{
return Rental.getMovie().GetMovieRentalStrategy() is MovieNewReleaseRentalStrategy &&
Rental.getDaysRented() > 1;
}

}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature Envy

Comment on lines +35 to +36
WriteOwedAmountTo(statementElements.Sum(statementElmenet => statementElmenet.Amount), statementBuilder);
WriteFrequentRenterPointstTo(statementElements.Sum(statementElmenet => statementElmenet.FrequentRenterPoints), statementBuilder);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single Responsibility
Should have been two methods: TotalAmount(), TotalFrequentRenterPoints()

Comment on lines +25 to +33
var statementElements = rentals.Select(rental =>
{
return new
{
Amount = rental.GetAmount(),
FrequentRenterPoints = new FrequentRenterPoints(rental).GetEarnedPoints(),
Description = $"\t{rental.getMovie().getTitle()}\t{rental.GetAmount()}"
};
});
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useless, you could also have iterated directly over rental.

@HerrNiklasRaab HerrNiklasRaab changed the title Code Review 1 code-review-1 Nov 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant