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.
Nullable
is enabled from v0.2.x.
-
- Point
- IntPoint
- IntPointWithValue
- Point3D
- Line
- BitMatrix
- BitArrayComparer
- TreeNode
- Node
- Ensure
- RangeHelpers
- LinearInterpolation
- AssemblyExtensions
- BitArrayExtensions
- CharExtensions
- CollectionExtensions
- DateTimeExtensions
- DictionaryExtensions
- DirectionExtensions
- DoubleExtensions
- EnumerableExtensions
- IntExtensions
- NumericExtensions
- StringExtensions
- StopwatchExtensions
- Vector2Extensions
2D Point class with an optional string
Id.
Slim 2D Point class, using ints and without an optional string
Value
Slim 2D Point class, using ints and with and optional string
Id
3D point class with an optional string
Id.
2D (straight) line class.
Class to work with bidimensional matrixes of bits.
IEqualityComparer<BitArray>
implementation
Tree node class with a generic key.
Tree node class with a string
key.
Essentially, TreeNode<string>
.
General math algorithms
LeastCommonMultiple(this IEnumerable<ulong>)
LeastCommonMultiple(ulong, ulong)
GreatestCommonDivisor(this IEnumerable<ulong>)
GreatestCommonDivisor(ulong, ulong)
Assert-style class that throws exceptions when things don't go as expected.
Equal()
/NotEqual()
Equals()
/NotEquals()
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>()
Reverse()
ToBitString()
GetDirection()
AddRange()
RemoveAll()
IsAfterNow()
IsAfter(DateTime)
MillisecondsFromEpoch()
StringId()
AddOrUpdate(TKey, TValue, Func<TKey, TValue, TValue>)
AddOrUpdate(TKey, Func<TKey, TValue>, Func<TKey, TValue, TValue>)
AddOrUpdate(TKey, Func<TKey, TArg, TValue>, Func<TKey, TValue, TArg, TValue>, TArg)
TurnLeft()
TurnRight()
Turn180()
Opposite()
DoubleEquals(double, precision)
ForEach()
IsNullOrEmpty()
IntersectAll()
Factorial()
Clamp(int, int)
Clamp<T>(T, T)
ElapsedMilliseconds()
ToFriendlyString()
IsEmpty()
IsWhiteSpace()
HasWhiteSpaces()
Truncate(int)
ReverseString()
ToBitArray(char = '1')
ToBoolEnumerable(char = '1')
RemoveBlanksAndMakeInvariant()
IsPalindrome()
Move(Direction, int)
Move(char, int)
DistanceTo()
ManhattanDistance()
ChebyshevDistance()
RotateCounterclockwise()
RotateClockwise()
ToFriendlyString()
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)
DoesNotThrowAsync(Func<Task>)