C
C#2y ago
Kays

❔ Confused about one of my Unit Testing

Hello, I'm doing a challenge to introduce myself into TDD but I'm getting struggling one of my unit test. There the context : __ Implementation of the business logic of a bank account: Expected functionalities: 1. Money deposit 2. Money withdrawal 3. View current balance 4. Consult previous transactions __ With my current solution architecture, I don't know how to develop the first test. Pictures show how the service is developt.
8 Replies
Kays
KaysOP2y ago
Up
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Black Knight
Black Knight2y ago
Hi, be more specific about ur question... I have some general comments on those screens: u may consider using 1. ArgumentNullException.ThrowIfNull() instead of this if checks 2. try to follow the AAA rule when u constructing tests as u can. 3. that _ after every single world in ur test case names is not preferred, u may want to read this article https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices
Best practices for writing unit tests - .NET
Learn best practices for writing unit tests that drive code quality and resilience for .NET Core and .NET Standard projects.
Mayor McCheese
When it comes to tdd I follow a practice sometimes called red letter coding. You write tests and your system under test is literally all red letters as they don't exist, then you use refactoring tools to create classes, fill in implementations, etc.
Black Knight
Black Knight2y ago
can u recommend me a good resource for this practice, i am interesting to know more about it ?
Mayor McCheese
I'm not finding anything that is awesome, but I've only done surface digging Maybe I'll do a night of TDD on a voice channel
Black Knight
Black Knight2y ago
@Mayor McCheese nice, ill be happy if u mentioned me
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?