Skip to content

Conversation

@nfaugout-lucca
Copy link
Contributor

  • Move extensions to specific directories / namespaces
  • Get new extension methods & tests from Lucca

After a new RC is released, will be referenced from a related Lucca PR

This way, we can reference only a part of the extensions from a client project, reducing collisions with third party extensions
@nfaugout-lucca nfaugout-lucca self-assigned this Nov 21, 2017
[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)
Copy link
Contributor

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 :)

Copy link
Contributor Author

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( ) ;)

Copy link
Contributor

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

Copy link
Contributor Author

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)
Copy link
Contributor

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)
Copy link
Contributor

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");
Copy link
Contributor

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
Copy link

codecov bot commented Nov 21, 2017

Codecov Report

Merging #43 into master will increase coverage by 5.21%.
The diff coverage is 68.8%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
NExtends/Primitives/Doubles/Double.extensions.cs 0% <ø> (ø)
...ds/Primitives/Expressions/Expression.extensions.cs 0% <ø> (ø)
...xtends/Primitives/TimeSpans/TimeSpan.extensions.cs 13.63% <ø> (ø)
...ends/Primitives/Exceptions/Exception.extensions.cs 0% <0%> (ø)
NExtends/Primitives/Enums/Enum.extensions.cs 10.71% <33.33%> (ø)
...Extends/Primitives/Generics/Generics.extensions.cs 73.12% <73.12%> (ø)
...xtends/Primitives/DateTimes/DateTime.extensions.cs 45.96% <75.43%> (ø)
NExtends/Primitives/Strings/String.extensions.cs 25.87% <0%> (+3.48%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e991c0...9c809fb. Read the comment docs.

BRK : .Cast<T, U, V>() becomes .Cast<T, U>(Type V)
@rducom rducom force-pushed the Migrate.From.Lucca branch from 9cc759a to 9c809fb Compare November 22, 2017 10:20
public static bool IsEquivalentTo<T>(this ICollection<T> expected, ICollection<T> actual, IEqualityComparer<T> comparer = null)
{
if (actual == null)
if (expected == null != (actual == null))
Copy link
Contributor Author

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

Copy link
Contributor

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)

@rducom rducom merged commit 68509fb into master Nov 22, 2017
@rducom rducom deleted the Migrate.From.Lucca branch November 22, 2017 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants