Building the software right 😉
- XUnit
- .NET Core 7
- FizzBuz Example
- EvenOrOdd Example
- Crud Example (in memory db)
If you find these explanations and examples helpful, please give me a star. Thank you!
Test Driven Development (TDD) is a software development practice that focuses on creating unit test cases before developing the actual code. It is an iterative approach combining programming, unit test creation, and refactoring.
RED: The red phase is the starting point of the cycle, where you define expectations for the piece of code being tested, and let the test fail. Write tests starting at the lowest level, e.g. when the function is passed an empty array, return an empty array. Why let the test fail? So that you know you have written a good test - a test shouldn't be able to pass without any logic.
GREEN: Implement the necessary logic to make your test pass - don't worry about it being the most optimised or efficient at this stage, the goal is to pass the test!
REFACTOR: During the refactor phase, consider how you could optimise your code, without adding any additional functionality.
- to develop the logic in your code
- Very high test-coverage
- Improved quality of your code
- Prevents bugs early on in the development process
- Easy to add functionality to your code
- Your code can be understood easily


