Thanks for the 10 minute format on FluentAssertions. Most of us can spare 10 minutes to learn something valuable. I hadn't thought about combining several tests within one unit test via AssertionScope(). It's been suggested that I test only one thing per unit test, but that unit definition is elusive. I think I need to be more pragmatic here. A "unit" does not need to be so fine grained. Thanks for reminding me of that.
@@IAmTimCorey I’m currently an asp web developer but my job wants me to look into more back end code to develop new versions and support our current version for our software. Do you have any videos or advice on understanding code that is already in place with little documentation?
As always thanks Tim for your videos. Helps me keep up with what's new in C#. Though would love to see some videos on code reviews of projects that you found interesting and what could be improved on them. I think it will help to understand how to deal with new code and improve it. Also thank you for making me love programming ❤️
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/ I'm glad I was able to help instill in you a love for programming.
Thanks ! If I might add, although I haven't tested that thoroughly yet, I keep hearing that Fluent Assertions is also one of the most ideal libraries for testing Json heavy functions and objects.. Don't quote me on that though.
Is unit testing even worth the effort for more complex types of classes? For instance, if you have a class that takes a number as a property (num). Then it has a property (By512) that multiplies 'num' by 512 and returns the result (getter). Now, imagine there are a dozen properties like "By512" that all do the same thing but have their own static value to multiply against, including integers and doubles. I feel like this type of scenario would require more time writing tests than there's actual code to do the work in the class being tested. Unless I'm not understanding this correctly.
The tests are like guardrails.They ensure we don't stray off the road. As for them taking too long to write, use AI like CoPilot to write them for you.
If any one of those methods stops working the way you want it to, well written unit tests will show you exactly which method is not behaving correctly and why. Otherwise you might spend hours digging through your code trying to figure out why this function isn't doing what you want. Even though the test code may be longer than the code you're testing, 99% of the time it is invaluable
In Dutch your sample would turn out even worse. You should write Eddie van Halen, van in lower case, but as soon as you split it, and only consider the last name, you should write Van Halen, capitalized. Normally in Dutch IT systems Van and Halen would be separate fields in the database, to make this processing easier. It can even get worse with names line Jan van de Berg, where you have two intermediate words. This is a very common Dutch name. It think this makes up for a nice localization issue. It even can be that the customer enters the name like this: Jan vd Berg.
Thanks for the 10 minute format on FluentAssertions. Most of us can spare 10 minutes to learn something valuable.
I hadn't thought about combining several tests within one unit test via AssertionScope(). It's been suggested that I test only one thing per unit test, but that unit definition is elusive. I think I need to be more pragmatic here. A "unit" does not need to be so fine grained. Thanks for reminding me of that.
I am glad it was helpful.
Great video. I need to go through your unit testing ones to make myself familiar with these processes
Thanks!
@@IAmTimCorey I’m currently an asp web developer but my job wants me to look into more back end code to develop new versions and support our current version for our software. Do you have any videos or advice on understanding code that is already in place with little documentation?
Nice tutorial. Reminded me of NUnit testing framework which has this built in
Glad you liked it!
As always thanks Tim for your videos. Helps me keep up with what's new in C#. Though would love to see some videos on code reviews of projects that you found interesting and what could be improved on them. I think it will help to understand how to deal with new code and improve it. Also thank you for making me love programming ❤️
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
I'm glad I was able to help instill in you a love for programming.
@IAmTimCorey Thank you Tim, that's a great idea. I will do that
Thanks ! If I might add, although I haven't tested that thoroughly yet, I keep hearing that Fluent Assertions is also one of the most ideal libraries for testing Json heavy functions and objects.. Don't quote me on that though.
You are welcome.
is there a c# equivalent for behavior driven development testing? fluent assertions are nice, but I don't know if they are enough.
Thank for this video. In additon to be a great teacher you have very good taste in music
You are welcome.
Nice, similar language elements to PowerShell's Pester unit testing module.
Thanks!
Nice and simple! Thanks, Tim!
You are welcome.
Very well done by community, and thanks Tim for this.
You are welcome.
Is unit testing even worth the effort for more complex types of classes? For instance, if you have a class that takes a number as a property (num). Then it has a property (By512) that multiplies 'num' by 512 and returns the result (getter). Now, imagine there are a dozen properties like "By512" that all do the same thing but have their own static value to multiply against, including integers and doubles. I feel like this type of scenario would require more time writing tests than there's actual code to do the work in the class being tested. Unless I'm not understanding this correctly.
The tests are like guardrails.They ensure we don't stray off the road. As for them taking too long to write, use AI like CoPilot to write them for you.
If any one of those methods stops working the way you want it to, well written unit tests will show you exactly which method is not behaving correctly and why. Otherwise you might spend hours digging through your code trying to figure out why this function isn't doing what you want. Even though the test code may be longer than the code you're testing, 99% of the time it is invaluable
In Dutch your sample would turn out even worse. You should write Eddie van Halen, van in lower case, but as soon as you split it, and only consider the last name, you should write Van Halen, capitalized. Normally in Dutch IT systems Van and Halen would be separate fields in the database, to make this processing easier. It can even get worse with names line Jan van de Berg, where you have two intermediate words. This is a very common Dutch name. It think this makes up for a nice localization issue. It even can be that the customer enters the name like this: Jan vd Berg.
That sounds tricky to deal with.
that's actually a really cool topic, I bet it's quite a headache.
So how you guys deal with such complicated issues? 😊
Thanks for the video. 😊
You are welcome.
A+ for using Eddie's name :-D
😆
LivingDoc is not reporting the failed tests if the soft assertions are failing.
Sounds like something you need to report.
Thanks
You are welcome.
clearly fluent assertions reads better and gives better error messages on failing tests. so is this the future ?
It does make working with failing tests easier.