Unit testing QueryWithResultSetExtractor #250
robsosno
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've recently made unit tests for my dao classes. It is not quite obvious how to do that. So I would like to show my approach.
I'll show this on example taken from Spring.Net - DataQuickStart/GenericTemplate.
Method to be tested from ResultSetExtractorDao class:
Test with NUnit, FakeItEasy, FluentAssertions and .NET 6:
Some may wonder what's the purpose of this test. I work in a corporate where code is automatically scanned and it is required to get some minimum coverage to pass quality gate.
This test is not very useful. But it has one important advantage: it has 100% code coverage.
I see that nowadays even most respectable companies like Baeldung are using similar approach - see Unit Test With Mock Object
Beta Was this translation helpful? Give feedback.
All reactions