Thanks to visit codestin.com
Credit goes to github.com

Skip to content

eduherminio/SheepTools

Repository files navigation

SheepTools

GitHub Actions Azure DevOps

Code coverage Sonar Quality Sonar vulnerabilities Sonar bugs Sonar code smells

SheepTools Nuget API
SheepTools.Moq Nuget API
SheepTools.XUnit Nuget API

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.

Relevant info

  • .NET Standard 2.0 and 2.1 were supported until v0.2.x.
  • Nullable is enabled from v0.2.x.

Content


SheepTools

Nuget

Point

2D Point class.

Line

2D (straight) line class.

Point3D

3D point class.

TreeNode

Tree node class with a generic key.

Node

Tree node class with a string key.

Essentially, TreeNode<string>.

Ensure

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

RangeHelpers

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]

LinearInterpolation

Helper methods to interpolate 2D points

  • InterpolateLinearly(double, double, double, double, double)
  • InterpolateYLinearly(double, Point, point)
  • InterpolateXLinearly(double, Point, point)

AssemblyExtensions

  • GetTypes<TAttribute>()
  • GetTypesAndAttributes<TAttribute>()
  • GetAssemblies<TInterface>()

CollectionExtensions

  • AddRange()
  • RemoveAll()

DateTimeExtensions

  • IsAfterNow()
  • IsAfter(DateTime)
  • MillisecondsFromEpoch()

DoubleExtensions

  • DoubleEquals(double, precision)

EnumerableExtensions

  • ForEach()
  • IsNullOrEmpty()

IntExtensions

  • Factorial()
  • Clamp(int, int)

NumericExtensions

  • Clamp<T>(T, T)

StringExtensions

  • IsEmpty()
  • HasWhiteSpaces()
  • Truncate(int)

SheepTools.Moq

Nuget

Depends on Moq and Microsoft.Extensions.Logging.

MoqLoggerExtensions

Helps verifying ILogger invocations.

  • VerifyLog(LogLevel, Message, Times)

  • VerifyLog<TException>(LogLevel, Exception, Message, Times)

MoqGenericLoggerExtensions

Helps verifying ILogger<T> invocations.

  • VerifyLog<T>(LogLevel, Message, Times)

  • VerifyLog<T, TException>(LogLevel, Exception, Message, Times)

SheepTools.XUnit

Nuget

Depends on XUnit.

Asssert

  • DoesNotThrow(Action)
  • DoesNotThrow(Func<object)
  • DoesNotThrow(Func<Task>)

About

Toolbox library with handy classes, extension methods, etc.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •