diff --git a/src/Wolfgang.TryPattern/Result.cs b/src/Wolfgang.TryPattern/Result.cs index ef94eb9..9499b57 100644 --- a/src/Wolfgang.TryPattern/Result.cs +++ b/src/Wolfgang.TryPattern/Result.cs @@ -18,10 +18,10 @@ public class Result /// /// A value indicating whether the operation succeeded. Set to /// if the operation was successful; otherwise, . - /// Error errorMessage associated with the result. + /// Error message associated with the result. /// - /// If the operation was successful, errorMessage must be an empty string. If the operation failed - /// errorMessage must not be null or empty + /// If the operation was successful, must be an empty string. If the operation failed, + /// must not be null, empty, or whitespace. /// protected Result ( @@ -32,10 +32,10 @@ protected Result switch (succeeded) { case true when errorMessage != string.Empty: - throw new ArgumentException("A successful result cannot have an error errorMessage.", nameof(errorMessage)); + throw new ArgumentException("A successful result cannot have an error message.", nameof(errorMessage)); case false when string.IsNullOrWhiteSpace(errorMessage): - throw new ArgumentException("A failed result must have an error errorMessage.", nameof(errorMessage)); + throw new ArgumentException("A failed result must have an error message.", nameof(errorMessage)); default: Succeeded = succeeded; @@ -59,7 +59,7 @@ public static Result Failure(string errorMessage) => /// - /// Creates a successful >. + /// Creates a successful . /// public static Result Success() => new(true, string.Empty); @@ -124,7 +124,7 @@ public static Result Flatten(params Result[] results) /// Returns true if any of the specified s indicate a failure. /// Otherwise, false. /// - /// The array of > to review + /// The array of to review. /// /// if any of the specified s failed, otherwise . /// @@ -137,7 +137,7 @@ public static bool AnyFailed(params Result[]? results) => /// /// Returns true if all the specified s indicate success. /// - /// The array of > to review + /// The array of to review. /// /// if all the specified s succeeded, otherwise . /// @@ -151,7 +151,7 @@ public static bool AllSucceeded(params Result[]? results) => /// /// The result of executing an . Contains properties indicating whether the operation /// or . If the operation failed the -/// property will contain message as to why. If the operation succeeded the +/// property will contain a message as to why. If the operation succeeded the /// property will contain the return value from the function. /// public class Result : Result @@ -171,11 +171,13 @@ public class Result : Result /// /// A value indicating whether the operation succeeded. Set to /// if the operation was successful; otherwise, . - /// Error errorMessage associated with the result. - /// The return value of the function if it succeeded, otherwise the default value for {T} + /// Error message associated with the result. + /// The return value of the function if it succeeded, otherwise the default value for . /// - /// If the operation was successful, errorMessage must be an empty string and value should be the return value from the function. - /// If the operation failed errorMessage must not be null or empty and the value should be default{T} + /// If the operation was successful, must be an empty string and + /// should be the return value from the function. + /// If the operation failed, must not be null, empty, or whitespace and + /// should be default(T). /// #if NET5_0_OR_GREATER private Result(bool succeeded, string? errorMessage, T? value) : base(succeeded, errorMessage) => _value = value; diff --git a/src/Wolfgang.TryPattern/Try.cs b/src/Wolfgang.TryPattern/Try.cs index a7dee81..614ff0d 100644 --- a/src/Wolfgang.TryPattern/Try.cs +++ b/src/Wolfgang.TryPattern/Try.cs @@ -16,7 +16,7 @@ public static class Try /// /// The action to execute. /// - /// A that indicates if the action was successful + /// A that indicates if the action was successful. /// public static Result Run(Action action) { @@ -44,7 +44,7 @@ public static Result Run(Action action) /// The action to execute. /// The CancellationToken to monitor. /// - /// A of representing the asynchronous operation + /// A of representing the asynchronous operation. /// public static async Task RunAsync(Action action, CancellationToken token = default) { @@ -77,7 +77,7 @@ public static async Task RunAsync(Action action, CancellationToken token /// The function to execute. /// /// A indicating if the function was successful or not and the result of - /// the function if it was. + /// the function if it was. /// #if NET5_0_OR_GREATER public static Result Run(Func function) @@ -116,6 +116,7 @@ public static Result Run(Func? function) #endif + /// /// Executes the specified function, catching any exception that may occur. /// @@ -170,9 +171,4 @@ public static async Task> RunAsync(Func> function, Cancella } } #endif - - - - } - diff --git a/tests/Wolfgang.TryPattern.Tests/RunAsyncFuncTests.cs b/tests/Wolfgang.TryPattern.Tests/RunAsyncFuncTests.cs index 27fe045..b6e6205 100644 --- a/tests/Wolfgang.TryPattern.Tests/RunAsyncFuncTests.cs +++ b/tests/Wolfgang.TryPattern.Tests/RunAsyncFuncTests.cs @@ -4,7 +4,7 @@ #endif namespace Wolfgang.TryPattern.Tests; -public class RunAsyncFuncTests // TODO Rename class and file +public class RunAsyncFuncTests { [Fact] public async Task RunAsync_Func_when_passed_null_throws_ArgumentNullException() diff --git a/tests/Wolfgang.TryPattern.Tests/RunFuncTests.cs b/tests/Wolfgang.TryPattern.Tests/RunFuncTests.cs index f9ef3b1..296c48a 100644 --- a/tests/Wolfgang.TryPattern.Tests/RunFuncTests.cs +++ b/tests/Wolfgang.TryPattern.Tests/RunFuncTests.cs @@ -3,7 +3,7 @@ #endif namespace Wolfgang.TryPattern.Tests; -public class RunFuncTests // TODO Rename class and file +public class RunFuncTests { [Fact] public void Run_Func_WithNullFunction_ThrowsArgumentNullException()