-
Notifications
You must be signed in to change notification settings - Fork 1
Migrate.from.lucca #43
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
Conversation
This way, we can reference only a part of the extensions from a client project, reducing collisions with third party extensions
We also migrate tests
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| public static bool IsNullOrEmpty<TSource>(this IEnumerable<TSource> source) => source == null || !source.Any(); | ||
|
|
||
| public static bool IsEquivalentTo<T>(this ICollection<T> expected, ICollection<T> actual, IEqualityComparer<T> comparer = null) |
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.
Call directly Contains() il will be simpler :)
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.
You should ask the guy that added this in Lucca why he didn't use Contains( ) ;)
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.
I modified Contains() implementation in NExtends on monday, that's why...
But now, in Generics.extensions.cs, IsEquivalentTo have pretty the same implementation than Contains()
we should factorise it
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.
OK, let's create an Issue for that, in order to avoid introducing regression in Lucca in case implementations are not strictly the same ;)
| } | ||
| } | ||
|
|
||
| private static string GetGermanDayOrdinalSuffix(DateTime date) |
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.
Should be a private const intead
| return "."; | ||
| } | ||
|
|
||
| private static string GetDutchDayOrdinalSuffix(DateTime date) |
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.
private const
| static DateTime LookFor(DateTime start, DayOfWeek day, int step) | ||
| { | ||
| if (step % 7 == 0) throw new Exception("Boucle infinie"); | ||
| if (step % 7 == 0) throw new Exception("Infinite loop"); |
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.
StackOverflowException or ArgumentException, but not just Exception
Codecov Report
@@ Coverage Diff @@
## master #43 +/- ##
==========================================
+ Coverage 21.9% 27.11% +5.21%
==========================================
Files 25 25
Lines 1447 1523 +76
Branches 158 168 +10
==========================================
+ Hits 317 413 +96
+ Misses 1117 1092 -25
- Partials 13 18 +5
Continue to review full report at Codecov.
|
9cc759a to
9c809fb
Compare
| public static bool IsEquivalentTo<T>(this ICollection<T> expected, ICollection<T> actual, IEqualityComparer<T> comparer = null) | ||
| { | ||
| if (actual == null) | ||
| if (expected == null != (actual == null)) |
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.
Wow c'est bizarre ça non ? Un peu trop "compact" à mon goût, dur à comprendre à première lecture
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.
Version longue c'est imbitable :
if (expected == null && actual != null || expected != null && actual == null)
After a new RC is released, will be referenced from a related Lucca PR