@feO2x feO2x released this Nov 18, 2018 · 26 commits to master since this release

Assets 2

Light.GuardClauses 6.1.0

  • Added support for .snupkg NuGet Symbol package
  • Added static Range class to simplify the creation of Range<T> instances

@feO2x feO2x released this Nov 10, 2018 · 32 commits to master since this release

Assets 2

Light.GuardClauses 6.0.0

  • Light.GuardClauses is now available as source code distribution with internal types (see Light.GuardClauses.SingleFile.cs in the top-level folder of the repository). You can also create you custom single source file by using the Light.GuardClauses.SourceCodeTransformation project.
  • Added string.Equals extension method which allows comparing strings ignoring the white space. Added corresponding MustBe and MustNotBe overloads for strings.
  • added char.IsLetter, char.IsDigit, char.IsLetterOrDigit, and char.IsWhiteSpace extension methods
  • fixed some typos in XML comments

Breaking changes:

  • Fixed typo in type: EqualivalentTypeComparer is now called EquivalentTypeComparer
  • IsValidEnumValue and MustBeValidEnumValue now use the new where T : Enum constraint of C# 7.3

@feO2x feO2x released this Aug 3, 2018 · 68 commits to master since this release

Assets 2

MustNotBeDefault now does not allocate when T is resolved to a value type

@feO2x feO2x released this Jul 29, 2018 · 72 commits to master since this release

Assets 2

Breaking Changes

New logic for custom exception and messages:

  • When an exceptionFactory is provided, the resulting exception is always thrown, no matter what check fails inside an assertion
  • Messages are passed to all exceptions that are thrown by Light.GuardClauses

See #53 for details.

@feO2x feO2x released this Jul 10, 2018 · 126 commits to master since this release

Assets 2

Light.GuardClauses 4.0

Important note: there are a lot of breaking changes in between version 3.5 and 4.0 - mainly because a lot of assertions were removed. If you are missing a particular assertion and think it should come back, please open an issue and let me know.

New Features:

  • Support for .NET Standard 2.0 and 1.0, .NET 4.5, .NET 4.0, .NET 3.5 and .NET 3.5 Compact Framework, as well as Silverlight 5 - thanks to @onovotny for his awesome MSBuildSdkExtras.
  • performance improvements across the board - thanks to @redknightlois for his consulting and @AndreyAkinshin and @adamsitnik for their awesome tool Benchmark.NET, many assertions are now about as fast as your imperative code (benchmarks performed in .NET 4.7.x and .NET Core 2.x).
  • ReSharper support via Contract Annotations - ReSharper now understands when Light.GuardClauses assertions do not return a null value and thus removes squiggly lines indicating a possible NullReferenceException.
  • Collection assertions are way faster now, do not allocate, and the returned value actually is the same collection type that was passed in.
  • New assertions and functionality:
    • Check.InvalidOperation and Check.InvalidState that throw an InvalidOperationException or InvalidStateException, respectively.
    • MustNotBeDefault asserts that a value is not default(T).
    • MustNotBeNullReference is the same as MustNotBeNull but for generic scenarios where T is not contrained to be a reference type.
    • IsValidEnumValue now supports enums marked with the FlagsAttribute, too.

Breaking Changes:

  • All assertions are now in the static Check class.
  • All assertions that throw exceptions were split into two overloads: one throwing the default exception, and one where a custom delegate exceptionFactory is provided.
  • Removed Check.That and Check.Against.
  • Removed all DictionaryAssertions - use the normal EnumerableAssertions on the Keys or Values collection of a dictionary if necessary.
  • Removed the following assertions because this is not an assertion library for unit testing:
    • MustBeTrue and MustBeFalse
    • MustNotHaveValue for Nullable<T>
    • Collection assertions:
      • IsContainingDuplicates
      • MustNotContainDuplicates
      • MustNotContainNull
      • MustBeSubsetOf
      • IsSubsetOf
      • MustContainInstancesOfDifferentTypes
      • IsContainingInstancesOfDifferentTypes
      • MustStartWith
      • IsStartingWith
      • MustEndWith
      • IsEndingWith
      • MustNotStartWith
      • MustNotEndWith
      • MustStartWithEquivalentOf
      • MustNotStartWithEquivalentOf
      • MustEndWithEquivalentOf
      • MustNotEndWithEquivalentOf
      • IsStructurallyEqualTo
      • IsStructurallyEquivalentTo
  • Removed IngoreCaseInfo and corresponding assertions for strings, instead overloads were added that use the well known StringComparison.
  • The following string assertions were removed:
    • IsMatching
    • IsContaining
    • MustContainOnlyLetters and ContainsOnlyLetters
    • MustContainOnlyLettersAndDigits and ContainsOnlyLettersAndDigits
    • MustHaveLengthIn, MustMotHaveLengthIn, and IsLengthIn
  • Removed extension methods IndexOf and IsContaining for IReadOnlyList<T>.
  • Class Equality is now called MultiplyAddHash, removed EqualsValueWithHashCode from it.
  • More fine-grained exception hierarchy.
  • StringBuilderExtensions are now called TextExtensions, removed AppendDictionaryContent and AppendKeyValuePair.
  • The Types class is now in namespace Light.GuardClauses, removed MulticastDelegateType.
  • All EqualityAssertions can now be found in Check.CommonAssertions.cs.
  • TypeAssertions has the following breaking changes:
    • All assertions that throw exceptions were removed
    • IsClass, IsInterface, IsDelegate, IsStruct, IsEnum, IsReferenceType, IsValueType, IsGenericParameter, IsAbstraction, and IsStaticClass were removed
    • Generally, everything in the context of TypeInfo was removed. The traditional reflection model already provides the members that achieve the most of the goals - TypeInfo is regarded as obsolete since .NET Standard 2.0.
  • Removed NotNull<T> because when used as a parameter, you cannot be sure that it wasn't created using the default struct initializer.

@feO2x feO2x released this Sep 3, 2017 · 374 commits to master since this release

Assets 2

New Features in version 3.5.0

  • added structural equality testing for collections: IsStructurallyEquivalentTo and IsStructurallyEqualTo
  • added overloads for AsList and AsReadOnlyList that allow you to specify a create-collection-delegate
  • added IndexOf and IsContaining for IReadOnlyList<T>

@feO2x feO2x released this Aug 27, 2017 · 384 commits to master since this release

Assets 2

New Features in version 3.4.0

  • added ExtractPropery and ExtractField for Expressions

@feO2x feO2x released this Aug 15, 2017 · 388 commits to master since this release

Assets 2

New Features in version 3.3.0

  • added IsStaticClass, MustBeStaticClass, and MustNotBeStaticClass for Types
  • added MustHaveMinimumLength and MustHaveMaximumLength for Strings
  • added IsLengthIn, MustHaveLengthIn, and MustNotHaveLengthIn for Strings

@feO2x feO2x released this Aug 14, 2017 · 392 commits to master since this release

Assets 2

New Features in version 3.2.0

  • added MustBeAbstraction and IsAbstraction for types
  • added IsMatching for strings
  • added ForEach and IsOneOf for enumerables

@feO2x feO2x released this Aug 6, 2017 · 399 commits to master since this release

Assets 2

New Features in version 3.1.0

Added assertion methods for generic types:

  • IsClosedConstructedGenericType
  • IsOpenConstructedGenericType
  • IsGenericTypeDefinition
  • IsGenericParameterType

Added boolean assertion methods:

  • MustNotBeTrue
  • MustNotBeFalse

Added more variants of existing assertion methods throwing no exception:

  • IsStartingWith and IsEndingWith
  • IsContainingDuplicates
  • IsSubsetOf