Assert.Kind.Message.Condition
1.0.10
dotnet add package Assert.Kind.Message.Condition --version 1.0.10
NuGet\Install-Package Assert.Kind.Message.Condition -Version 1.0.10
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Assert.Kind.Message.Condition" Version="1.0.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Assert.Kind.Message.Condition" Version="1.0.10" />
<PackageReference Include="Assert.Kind.Message.Condition" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Assert.Kind.Message.Condition --version 1.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Assert.Kind.Message.Condition, 1.0.10"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Assert.Kind.Message.Condition@1.0.10
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Assert.Kind.Message.Condition&version=1.0.10
#tool nuget:?package=Assert.Kind.Message.Condition&version=1.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Overview
The assertion library with a very convenient method chaining api (aka fluent interface).
Reference
public static class Assert {
public static class Argument {
public static Assertions.Argument Message(FormattableString? value);
}
public static class Operation {
public static Assertions.Operation Message(FormattableString? value);
}
}
public static class Assertions {
public readonly struct Argument {
public void Valid(bool isValid);
public void NotNull(bool isValid);
public void InRange(bool isValid);
}
public readonly struct Operation {
public void Valid(bool isValid);
public void Ready(bool isValid);
public void NotDisposed(bool isValid);
}
}
public static class Exceptions {
public static class Argument {
public static ArgumentException ArgumentException(FormattableString? message);
public static ArgumentNullException ArgumentNullException(FormattableString? message);
public static ArgumentOutOfRangeException ArgumentOutOfRangeException(FormattableString? message);
}
public static class Operation {
public static InvalidOperationException InvalidOperationException(FormattableString? message);
public static ObjectNotReadyException ObjectNotReadyException(FormattableString? message);
public static ObjectDisposedException ObjectDisposedException(FormattableString? message);
}
public static class Internal {
public static Exception Exception(FormattableString? message);
public static NullReferenceException NullReference(FormattableString? message);
public static NotSupportedException NotSupported(FormattableString? message);
public static NotImplementedException NotImplemented(FormattableString? message);
}
}
Example
// Assert.Argument
Assert.Argument.Message( $"ArgumentException" ).Valid( ... )
Assert.Argument.Message( $"ArgumentNullException" ).NotNull( ... )
Assert.Argument.Message( $"ArgumentOutOfRangeException" ).InRange( ... )
// Assert.Operation
Assert.Operation.Message( $"InvalidOperationException" ).Valid( ... )
Assert.Operation.Message( $"ObjectNotReadyException" ).Ready( ... )
Assert.Operation.Message( $"ObjectDisposedException" ).NotDisposed( ... )
// Exceptions.Argument
throw Exceptions.Argument.ArgumentException( $"ArgumentException" )
throw Exceptions.Argument.ArgumentNullException( $"ArgumentNullException" )
throw Exceptions.Argument.ArgumentOutOfRangeException( $"ArgumentOutOfRangeException" )
// Exceptions.Operation
throw Exceptions.Operation.InvalidOperationException( $"InvalidOperationException" )
throw Exceptions.Operation.ObjectNotReadyException( $"ObjectNotReadyException" )
throw Exceptions.Operation.ObjectDisposedException( $"ObjectDisposedException" )
// Exceptions.Internal
throw Exceptions.Internal.Exception( $"Exception" )
throw Exceptions.Internal.NullReference( $"NullReferenceException" )
throw Exceptions.Internal.NotSupported( $"NotSupportedException" )
throw Exceptions.Internal.NotImplemented( $"NotImplementedException" )
Links
- https://github.com/denis535/Net.Extensions
- https://www.nuget.org/packages/Assert.Kind.Message.Condition
P.S.
Note that it is preferable to check the arguments first, and then everything else. This is because other checks may depend on the validity of the your arguments.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.