-
Notifications
You must be signed in to change notification settings - Fork 416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add UsingTestingSequence
to enforce simpler & correct usage
#475
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I think all the explanation and operator list should be in a issue. So we can create PR for each operator. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #475 +/- ##
=======================================
Coverage 92.39% 92.39%
=======================================
Files 112 112
Lines 3447 3447
Branches 1021 1021
=======================================
Hits 3185 3185
Misses 200 200
Partials 62 62 ☔ View full report in Codecov by Sentry. |
Conflicts resolved: - MoreLinq.Test/EndsWithTest.cs - MoreLinq.Test/RankTest.cs
UsingTestingSequence
to enforce simpler & correct usage
This PR obsoletes the use of
AsTestingSequence
in favour of the newUsingTestingSequence
. This is done to enforces simpler & more correct usage.TestingSequence
is primarily designed to help test two things in an operator:However, most uses seemed to be exercising the first but not the second. The latter was probably often skipped/missed because it required more non-obvious setup; an explicit
using
block (non-obvious usage) as well as eager evaluation before assertion of results. Take the following example:This will only ensure that
Rank
doesn't iteratesequence
more than once when it's iterated during testing. To also test that it disposes the source iterator when done, the above has to be written as:With
UsingTestingSequence
, you just do:TestingSequence
Uses Needing ReviewCompareCountTest
CountDownTest
EndsWithTest
EquiZipTest
FlattenTest
FoldTest
InterleaveTest
MoveTest
NestedLoopTest
RankTest
SortedMergeTest
StartsWithTest
TakeLastTest
TestingSequence
TransposeTest
ZipLongestTest
ZipShortestTest