chore: run dotnet format

This commit is contained in:
Stevan Freeborn
2026-03-30 17:29:41 -05:00
parent 0630a67307
commit b177276b3d
6 changed files with 222 additions and 222 deletions
+77 -77
View File
@@ -53,23 +53,23 @@ namespace StevanFreeborn.Results
/// <exception cref="ArgumentNullException">Thrown when func or errorHandler is null.</exception>
public static Result<T, TError> Try<T, TError>(Func<T> func, Func<Exception, TError> errorHandler) where TError : IError
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(func);
#else
if (func is null)
{
throw new ArgumentNullException(nameof(func));
}
#endif
#else
if (func is null)
{
throw new ArgumentNullException(nameof(func));
}
#endif
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(errorHandler);
#else
if (errorHandler is null)
{
throw new ArgumentNullException(nameof(errorHandler));
}
#endif
#else
if (errorHandler is null)
{
throw new ArgumentNullException(nameof(errorHandler));
}
#endif
try
{
@@ -150,14 +150,14 @@ namespace StevanFreeborn.Results
/// <exception cref="ArgumentNullException">Thrown when mapper is null.</exception>
public Result<TNew, TError> Map<TNew>(Func<T, TNew> mapper)
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(mapper);
#else
if (mapper is null)
{
throw new ArgumentNullException(nameof(mapper));
}
#endif
#else
if (mapper is null)
{
throw new ArgumentNullException(nameof(mapper));
}
#endif
return IsSuccess ? Result.Ok<TNew, TError>(mapper(Value)) : Result.Fail<TNew, TError>(Error);
}
@@ -170,14 +170,14 @@ namespace StevanFreeborn.Results
/// <exception cref="ArgumentNullException">Thrown when mapper is null.</exception>
public Result<T, TNewError> MapError<TNewError>(Func<TError, TNewError> mapper) where TNewError : IError
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(mapper);
#else
if (mapper is null)
{
throw new ArgumentNullException(nameof(mapper));
}
#endif
#else
if (mapper is null)
{
throw new ArgumentNullException(nameof(mapper));
}
#endif
return IsFailure ? Result.Fail<T, TNewError>(mapper(Error)) : Result.Ok<T, TNewError>(Value);
}
@@ -191,14 +191,14 @@ namespace StevanFreeborn.Results
/// <exception cref="ArgumentNullException">Thrown when binder is null.</exception>
public Result<TNew, TError> Bind<TNew>(Func<T, Result<TNew, TError>> binder)
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(binder);
#else
if (binder is null)
{
throw new ArgumentNullException(nameof(binder));
}
#endif
#else
if (binder is null)
{
throw new ArgumentNullException(nameof(binder));
}
#endif
return IsSuccess ? binder(Value) : Result.Fail<TNew, TError>(Error);
}
@@ -213,23 +213,23 @@ namespace StevanFreeborn.Results
/// <exception cref="ArgumentNullException">Thrown when onSuccess or onFailure is null.</exception>
public TResult Match<TResult>(Func<T, TResult> onSuccess, Func<TError, TResult> onFailure)
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(onSuccess);
#else
if (onSuccess is null)
{
throw new ArgumentNullException(nameof(onSuccess));
}
#endif
#else
if (onSuccess is null)
{
throw new ArgumentNullException(nameof(onSuccess));
}
#endif
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(onFailure);
#else
if (onFailure is null)
{
throw new ArgumentNullException(nameof(onFailure));
}
#endif
#else
if (onFailure is null)
{
throw new ArgumentNullException(nameof(onFailure));
}
#endif
return IsSuccess ? onSuccess(Value) : onFailure(Error);
}
@@ -242,23 +242,23 @@ namespace StevanFreeborn.Results
/// <exception cref="ArgumentNullException">Thrown when onSuccess or onFailure is null.</exception>
public void Match(Action<T> onSuccess, Action<TError> onFailure)
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(onSuccess);
#else
if (onSuccess is null)
{
throw new ArgumentNullException(nameof(onSuccess));
}
#endif
#else
if (onSuccess is null)
{
throw new ArgumentNullException(nameof(onSuccess));
}
#endif
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(onFailure);
#else
if (onFailure is null)
{
throw new ArgumentNullException(nameof(onFailure));
}
#endif
#else
if (onFailure is null)
{
throw new ArgumentNullException(nameof(onFailure));
}
#endif
if (IsSuccess)
{
@@ -278,14 +278,14 @@ namespace StevanFreeborn.Results
/// <exception cref="ArgumentNullException">Thrown when action is null.</exception>
public Result<T, TError> Map(Action<T> action)
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(action);
#else
if (action is null)
{
throw new ArgumentNullException(nameof(action));
}
#endif
#else
if (action is null)
{
throw new ArgumentNullException(nameof(action));
}
#endif
if (IsSuccess)
{
@@ -302,14 +302,14 @@ namespace StevanFreeborn.Results
/// <exception cref="ArgumentNullException">Thrown when action is null.</exception>
public Result<T, TError> Map(Action action)
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(action);
#else
if (action is null)
{
throw new ArgumentNullException(nameof(action));
}
#endif
#else
if (action is null)
{
throw new ArgumentNullException(nameof(action));
}
#endif
if (IsSuccess)
{
@@ -19,23 +19,23 @@ namespace StevanFreeborn.Results
public static async Task<Result<TNew, TError>> MapAsync<T, TNew, TError>(this Result<T, TError> result, Func<T, Task<TNew>> mapper)
where TError : IError
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(result);
#else
if (result is null)
{
throw new ArgumentNullException(nameof(result));
}
#endif
#else
if (result is null)
{
throw new ArgumentNullException(nameof(result));
}
#endif
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(mapper);
#else
if (mapper is null)
{
throw new ArgumentNullException(nameof(mapper));
}
#endif
#else
if (mapper is null)
{
throw new ArgumentNullException(nameof(mapper));
}
#endif
return result.IsSuccess ? await mapper(result.Value).ConfigureAwait(false) : result.Error;
}
@@ -54,23 +54,23 @@ namespace StevanFreeborn.Results
where TError : IError
where TNewError : IError
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(result);
#else
if (result is null)
{
throw new ArgumentNullException(nameof(result));
}
#endif
#else
if (result is null)
{
throw new ArgumentNullException(nameof(result));
}
#endif
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(mapper);
#else
if (mapper is null)
{
throw new ArgumentNullException(nameof(mapper));
}
#endif
#else
if (mapper is null)
{
throw new ArgumentNullException(nameof(mapper));
}
#endif
return result.IsFailure ? await mapper(result.Error).ConfigureAwait(false) : Result.Ok<T, TNewError>(result.Value);
}
@@ -86,23 +86,23 @@ namespace StevanFreeborn.Results
public static async Task<Result<Unit, TError>> MapAsync<TError>(this Result<Unit, TError> result, Func<Unit, Task> onSuccess)
where TError : IError
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(result);
#else
if (result is null)
{
throw new ArgumentNullException(nameof(result));
}
#endif
#else
if (result is null)
{
throw new ArgumentNullException(nameof(result));
}
#endif
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(onSuccess);
#else
if (onSuccess is null)
{
throw new ArgumentNullException(nameof(onSuccess));
}
#endif
#else
if (onSuccess is null)
{
throw new ArgumentNullException(nameof(onSuccess));
}
#endif
if (result.IsSuccess)
{
@@ -123,23 +123,23 @@ namespace StevanFreeborn.Results
public static async Task<Result<Unit, TError>> BindAsync<TError>(this Result<Unit, TError> result, Func<Unit, Task<Result<Unit, TError>>> onSuccess)
where TError : IError
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(result);
#else
if (result is null)
{
throw new ArgumentNullException(nameof(result));
}
#endif
#else
if (result is null)
{
throw new ArgumentNullException(nameof(result));
}
#endif
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(onSuccess);
#else
if (onSuccess is null)
{
throw new ArgumentNullException(nameof(onSuccess));
}
#endif
#else
if (onSuccess is null)
{
throw new ArgumentNullException(nameof(onSuccess));
}
#endif
return result.IsSuccess ? await onSuccess(result.Value).ConfigureAwait(false) : result;
}
@@ -157,32 +157,32 @@ namespace StevanFreeborn.Results
public static async Task<TResult> MatchAsync<TResult, TError>(this Result<Unit, TError> result, Func<Unit, Task<TResult>> onSuccess, Func<TError, Task<TResult>> onFailure)
where TError : IError
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(result);
#else
if (result is null)
{
throw new ArgumentNullException(nameof(result));
}
#endif
#else
if (result is null)
{
throw new ArgumentNullException(nameof(result));
}
#endif
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(onSuccess);
#else
if (onSuccess is null)
{
throw new ArgumentNullException(nameof(onSuccess));
}
#endif
#else
if (onSuccess is null)
{
throw new ArgumentNullException(nameof(onSuccess));
}
#endif
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(onFailure);
#else
if (onFailure is null)
{
throw new ArgumentNullException(nameof(onFailure));
}
#endif
#else
if (onFailure is null)
{
throw new ArgumentNullException(nameof(onFailure));
}
#endif
return result.IsSuccess
? await onSuccess(result.Value).ConfigureAwait(false)
@@ -208,23 +208,23 @@ namespace StevanFreeborn.Results
/// <exception cref="ArgumentNullException">Thrown when action or errorHandler is null.</exception>
public static async Task<Result<Unit, Error>> TryAsync(Func<Task> action, Func<Exception, Error> errorHandler)
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(action);
#else
if (action is null)
{
throw new ArgumentNullException(nameof(action));
}
#endif
#else
if (action is null)
{
throw new ArgumentNullException(nameof(action));
}
#endif
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(errorHandler);
#else
if (errorHandler is null)
{
throw new ArgumentNullException(nameof(errorHandler));
}
#endif
#else
if (errorHandler is null)
{
throw new ArgumentNullException(nameof(errorHandler));
}
#endif
try
{
@@ -250,23 +250,23 @@ namespace StevanFreeborn.Results
public static async Task<Result<TNew, TError>> BindAsync<T, TNew, TError>(this Result<T, TError> result, Func<T, Task<Result<TNew, TError>>> binder)
where TError : IError
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(result);
#else
if (result is null)
{
throw new ArgumentNullException(nameof(result));
}
#endif
#else
if (result is null)
{
throw new ArgumentNullException(nameof(result));
}
#endif
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(binder);
#else
if (binder is null)
{
throw new ArgumentNullException(nameof(binder));
}
#endif
#else
if (binder is null)
{
throw new ArgumentNullException(nameof(binder));
}
#endif
return result.IsSuccess ? await binder(result.Value).ConfigureAwait(false) : Result.Fail<TNew, TError>(result.Error);
}
@@ -285,32 +285,32 @@ namespace StevanFreeborn.Results
public static async Task<TResult> MatchAsync<T, TResult, TError>(this Result<T, TError> result, Func<T, Task<TResult>> onSuccess, Func<TError, Task<TResult>> onFailure)
where TError : IError
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(result);
#else
if (result is null)
{
throw new ArgumentNullException(nameof(result));
}
#endif
#else
if (result is null)
{
throw new ArgumentNullException(nameof(result));
}
#endif
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(onSuccess);
#else
if (onSuccess is null)
{
throw new ArgumentNullException(nameof(onSuccess));
}
#endif
#else
if (onSuccess is null)
{
throw new ArgumentNullException(nameof(onSuccess));
}
#endif
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(onFailure);
#else
if (onFailure is null)
{
throw new ArgumentNullException(nameof(onFailure));
}
#endif
#else
if (onFailure is null)
{
throw new ArgumentNullException(nameof(onFailure));
}
#endif
return result.IsSuccess
? await onSuccess(result.Value).ConfigureAwait(false)
@@ -338,23 +338,23 @@ namespace StevanFreeborn.Results
/// <exception cref="ArgumentNullException">Thrown when func or errorHandler is null.</exception>
public static async Task<Result<T, Error>> TryAsync<T>(Func<Task<T>> func, Func<Exception, Error> errorHandler)
{
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(func);
#else
if (func is null)
{
throw new ArgumentNullException(nameof(func));
}
#endif
#else
if (func is null)
{
throw new ArgumentNullException(nameof(func));
}
#endif
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(errorHandler);
#else
if (errorHandler is null)
{
throw new ArgumentNullException(nameof(errorHandler));
}
#endif
#else
if (errorHandler is null)
{
throw new ArgumentNullException(nameof(errorHandler));
}
#endif
try
{