melodron / RefactoringKata

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactoring Kata

Goal

The goal of this kata is to find the code smells of this legacy code and fix them in the safest way.

If you are confident with unit testing, we highly recommend to write some tests before refactoring the legacy code. This legacy code is not so testable, it's highly probable that you need to make some changes to the code before you can write your test. But try to reduce to the maximum the changes to make the code testable.

  • Fork the repository and open the solution with visual studio.
  • Commit at each step of your refactoring process.
  • When you're done, push and send the link of your repository to etienne.pierrot@mangopay.com

Feel free to use another framework test or any mock library. If you feel that you are not able to put under tests this messy code, go straight to the refactoring without testing.

Specification

The Wallet service (WalletKata/Wallets/WalletService.cs) allow a user to consult the wallets of a friend.

  1. If the user is not logged, the service throw a UserNotLoggedInException.
  2. If the logged user is not friend with the user passed in argument, the service return a empty list.
  3. If the logged user is friend with the user passed in argument, the service return the list of wallet fetched from the database.

Info : the database and the session is a stub wich throw an exception.

About


Languages

Language:C# 100.0%