Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
40 views1 page

TP #4: October 11 - Testing - Refactoring - Injection: Pokerhandsrankertests. What Tests Could You Add?

This document discusses code for ranking poker hands using classes organized as micro-services with dependency injection following SOLID principles. It asks to write missing unit tests using NUnit, NSubstitute and NFluent, and refactor the code to allow choosing the number of players up to 8, using multiple decks of cards up to 4, and optionally displaying hand names from another micro-service.

Uploaded by

Momar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views1 page

TP #4: October 11 - Testing - Refactoring - Injection: Pokerhandsrankertests. What Tests Could You Add?

This document discusses code for ranking poker hands using classes organized as micro-services with dependency injection following SOLID principles. It asks to write missing unit tests using NUnit, NSubstitute and NFluent, and refactor the code to allow choosing the number of players up to 8, using multiple decks of cards up to 4, and optionally displaying hand names from another micro-service.

Uploaded by

Momar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

TP #4: October 11th – Testing – Refactoring – Injection

Please take some to read and discover how the code from the project “PokerHandsRanker” is
organized. This code is organized between many classes, each having a separate and define
role. These classes are organized as “micro-services” and injected with calling classes using
dependency injection. All these classes respect the S.O.L.I.D. principles.

Question’s part (I expect a document with the answer):


1. What is the purpose of this code in a few lines?
2. Create a small UML diagram of the link between these classes. You can use an online
UML diagram editor to generate an image.
3. What are micro-services?
4. What is the goal of S.O.L.I.D. principles (not the definition)?
5. What is Dependency Injection? In what class is it done?
6. Explain to a manager (without technical terms) why tests are important and why
testing something that works is crucial on the long term.
7. What is refactoring? Why is it useful?
a. Find 3 ways you could expand this code to add more functionalities.
b. Choose a method that you would refactor. Why? What is the benefice of testing
this method first ?

Requirements:
1. Using NUnit, NSubstitute and NFluent, write the missing tests in the
PokerHandsRankerTests. What tests could you add?
2. Refactor this code, to:
a. Choose the number of players, up to 8.
b. Play with more than one deck of cards, up to 4.
c. (Optional) Have the correct names of hand displayed in HandPrinterService
(line 18) using another micro-service and dependency injection.

You might also like