| SheepTools | ||
|---|---|---|
| SheepTools.Moq | ||
| SheepTools.XUnit |
SheepTools is a .NET toolbox library (yet another!) which contains handy classes, extension methods, etc.
It's divided in different libraries so that using the general purpose, main one doesn't imply adding any transitive dependencies to your project.
I'm more than happy to accept suggestions, comments, or addition proposals.
- .NET Standard 2.0 and 2.1 were supported until v0.2.x.
Nullableis enabled from v0.2.x.
2D Point class.
2D (straight) line class.
3D point class.
Tree node class with a generic key.
Tree node class with a string key.
Essentially, TreeNode<string>.
Assert-style class that throws exceptions when things don't go as expected.
Equal()/NotEqual()True()/False()Null()/NotNull()Empty()/NotEmpty()NullOrEmpty()/NotNullOrEmpty()NullOrWhiteSpace()/NotNullOrWhiteSpace()Count<T>(int, IEnumerable<T>, Func<T, bool>)
Helper class to generate ranges of numbers before having to check if it was (a, b), [a, b] or (a, b] in Microsoft documentation every time I use Enumberable.Range.
GenerateRange(int, int)-> [a, b]
Helper methods to interpolate 2D points
InterpolateLinearly(double, double, double, double, double)InterpolateYLinearly(double, Point, point)InterpolateXLinearly(double, Point, point)
GetTypes<TAttribute>()GetTypesAndAttributes<TAttribute>()GetAssemblies<TInterface>()
AddRange()RemoveAll()
IsAfterNow()IsAfter(DateTime)MillisecondsFromEpoch()
DoubleEquals(double, precision)
ForEach()IsNullOrEmpty()
Factorial()Clamp(int, int)
Clamp<T>(T, T)
IsEmpty()HasWhiteSpaces()Truncate(int)
Depends on Moq and Microsoft.Extensions.Logging.
Helps verifying ILogger invocations.
-
VerifyLog(LogLevel, Message, Times) -
VerifyLog<TException>(LogLevel, Exception, Message, Times)
Helps verifying ILogger<T> invocations.
-
VerifyLog<T>(LogLevel, Message, Times) -
VerifyLog<T, TException>(LogLevel, Exception, Message, Times)
Depends on XUnit.
DoesNotThrow(Action)DoesNotThrow(Func<object)DoesNotThrow(Func<Task>)