rename tests
All checks were successful
default / default (8.0) (push) Successful in 35s

This commit is contained in:
Louis Seubert 2024-04-29 22:59:44 +02:00
parent 30ef7bd477
commit a9a923120f
Signed by: louis9902
GPG key ID: 4B9DB28F826553BD
10 changed files with 117 additions and 117 deletions

View file

@ -4,7 +4,7 @@ namespace Geekeey.Extensions.Result.Tests;
internal sealed class ErrorTests
{
[Test]
public void ImplicitConversion_FromString_ReturnsStringError()
public void I_can_implicitly_convert_from_string_and_get_string_error()
{
Error error = "error";
@ -16,7 +16,7 @@ internal sealed class ErrorTests
}
[Test]
public void ImplicitConversion_FromException_ReturnsExceptionError()
public void I_can_implicitly_convert_from_exception_and_get_exception_error()
{
Error error = new CustomTestException();

View file

@ -4,7 +4,7 @@ namespace Geekeey.Extensions.Result.Tests;
internal sealed class ExtensionsEnumerableTests
{
[Test]
public void Join_ReturnsAllSuccess_ForSequenceContainingAllSuccess()
public void I_can_join_sequence_and_get_all_success_when_all_elements_are_success()
{
IEnumerable<Result<int>> xs = [1, 2, 3, 4, 5];
@ -18,7 +18,7 @@ internal sealed class ExtensionsEnumerableTests
}
[Test]
public void Join_ReturnsFirstFailure_ForSequenceContainingFailure()
public void I_can_join_sequence_and_get_first_failure_when_sequence_contains_failure()
{
IEnumerable<Result<int>> xs =
[
@ -39,7 +39,7 @@ internal sealed class ExtensionsEnumerableTests
}
[Test]
public void Join_ReturnsSuccess_ForEmptySequence()
public void I_can_join_empty_sequence_and_get_success()
{
IEnumerable<Result<int>> xs = [];

View file

@ -4,7 +4,7 @@ namespace Geekeey.Extensions.Result.Tests;
internal sealed class PreludeTests
{
[Test]
public void Try_ReturnsSuccess_WithoutThrowing()
public void I_can_try_with_success_value_and_get_a_success_result()
{
var result = Try(() => 2);
@ -16,7 +16,7 @@ internal sealed class PreludeTests
}
[Test]
public void Try_ReturnsFailure_WithThrowing()
public void I_can_try_with_throwing_exception_and_get_a_failure_result()
{
var result = Try<int>(() => throw new CustomTestException());
@ -30,7 +30,7 @@ internal sealed class PreludeTests
}
[Test]
public async Task TryAsync_ReturnsSuccess_WithoutThrowing_Task()
public async Task I_can_try_with_async_success_value_and_get_a_success_result()
{
var result = await TryAsync(() => Task.FromResult(2));
@ -42,7 +42,7 @@ internal sealed class PreludeTests
}
[Test]
public async Task TryAsync_ReturnsFailure_WithThrowing_Task()
public async Task I_can_try_with_async_throwing_exception_and_get_a_failure_result()
{
var result = await TryAsync(Task<int> () => throw new CustomTestException());
@ -56,7 +56,7 @@ internal sealed class PreludeTests
}
[Test]
public async Task TryAsync_ReturnsFailure_WithAwaitThrowing_Task()
public async Task I_can_try_with_async_await_throwing_exception_and_get_a_failure_result()
{
var result = await TryAsync(async Task<int> () =>
{
@ -74,7 +74,7 @@ internal sealed class PreludeTests
}
[Test]
public async Task TryAsync_ReturnsSuccess_WithoutThrowing_ValueTask()
public async Task I_can_try_with_async_success_value_and_get_a_success_result_of_type_ValueTask()
{
var result = await TryAsync(() => ValueTask.FromResult(2));
@ -86,7 +86,7 @@ internal sealed class PreludeTests
}
[Test]
public async Task TryAsync_ReturnsFailure_WithThrowing_ValueTask()
public async Task I_can_try_with_async_throwing_exception_and_get_a_failure_result_of_type_ValueTask()
{
var result = await TryAsync(ValueTask<int> () => throw new CustomTestException());
@ -100,7 +100,7 @@ internal sealed class PreludeTests
}
[Test]
public async Task TryAsync_ReturnsFailure_WithAwaitThrowing_ValueTask()
public async Task I_can_try_with_async_await_throwing_exception_and_get_a_failure_result_of_type_ValueTask()
{
var result = await TryAsync(async ValueTask<int> () =>
{

View file

@ -4,7 +4,7 @@ namespace Geekeey.Extensions.Result.Tests;
internal sealed class ResultConversionTests
{
[Test]
public void ImplicitConversion_FromValue_IsSuccess()
public void I_can_implicitly_convert_from_value_and_get_success()
{
var result = Success(2);
@ -17,7 +17,7 @@ internal sealed class ResultConversionTests
}
[Test]
public void ImplicitConversion_FromError_IsFailure()
public void I_can_implicitly_convert_from_error_and_get_failure()
{
var error = new CustomTestError();
var result = Failure<int>(error);
@ -31,7 +31,7 @@ internal sealed class ResultConversionTests
}
[Test]
public void Unwrap_ReturnsValue_ForSuccess()
public void I_can_unwrap_and_get_value_for_success()
{
var result = Success(2);
var value = result.Unwrap();
@ -40,7 +40,7 @@ internal sealed class ResultConversionTests
}
[Test]
public void Unwrap_Throws_ForFailure()
public void I_can_unwrap_and_get_exception_for_failure()
{
var result = Failure<int>("error");
@ -48,7 +48,7 @@ internal sealed class ResultConversionTests
}
[Test]
public void ExplicitConversion_ReturnsValue_ForSuccess()
public void I_can_explicitly_convert_and_get_value_for_success()
{
var result = Success(2);
var value = (int)result;
@ -57,7 +57,7 @@ internal sealed class ResultConversionTests
}
[Test]
public void ExplicitConversion_Throws_ForFailure()
public void I_can_explicitly_convert_and_get_exception_for_failure()
{
var result = Failure<int>("error");

View file

@ -4,7 +4,7 @@ namespace Geekeey.Extensions.Result.Tests;
internal sealed class ResultEqualityTests
{
[Test]
public void Equals_T_ReturnsTrue_ForSuccessAndEqualValue()
public void I_can_equal_t_and_get_true_for_success_with_equal_value()
{
var a = Success(2);
var b = 2;
@ -13,7 +13,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_T_ReturnsFalse_ForSuccessAndUnequalValue()
public void I_can_equal_t_and_get_false_for_success_with_unequal_value()
{
var a = Success(2);
var b = 3;
@ -22,7 +22,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_T_ReturnsFalse_ForFailure()
public void I_can_equal_t_and_get_false_for_failure()
{
var a = Failure<int>("error");
var b = 2;
@ -31,7 +31,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_Result_ReturnsTrue_ForSuccessAndSuccessAndEqualValue()
public void I_can_equal_result_and_get_true_for_success_and_success_with_equal_value()
{
var a = Success(2);
var b = Success(2);
@ -40,7 +40,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_Result_ReturnsFalse_ForSuccessAndSuccessAndUnequalValue()
public void I_can_equal_result_and_get_false_for_success_and_success_with_unequal_value()
{
var a = Success(2);
var b = Success(3);
@ -49,7 +49,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_Result_ReturnsFalse_ForSuccessAndFailure()
public void I_can_equals_result_and_get_false_for_success_and_failure()
{
var a = Success(2);
var b = Failure<int>("error 1");
@ -58,7 +58,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_Result_ReturnsFalse_ForFailureAndSuccess()
public void I_can_equals_result_and_get_false_for_failure_and_success()
{
var a = Failure<int>("error");
var b = Success(2);
@ -67,7 +67,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_Result_ReturnsTrue_ForFailureAndFailure()
public void I_can_equals_result_and_get_true_for_failure_and_failure()
{
var a = Failure<int>("error 1");
var b = Failure<int>("error 2");
@ -76,7 +76,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_T_ReturnsTrue_ForSuccessAndEqualValue_WithComparer()
public void I_can_equal_t_and_get_true_for_success_with_equal_value_using_comparer()
{
var a = Success(2);
var b = 2;
@ -85,7 +85,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_T_ReturnsFalse_ForSuccessAndUnequalValue_WithComparer()
public void I_can_equal_t_and_get_false_for_success_with_unequal_value_using_comparer()
{
var a = Success(2);
var b = 3;
@ -94,7 +94,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_T_ReturnsFalse_ForFailure_WithComparer()
public void I_can_equal_t_and_get_false_for_failure_using_comparer()
{
var a = Failure<int>("error");
var b = 2;
@ -103,7 +103,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_Result_ReturnsTrue_ForSuccessAndSuccessAndEqualValue_WithComparer()
public void I_can_equal_result_and_get_true_for_success_and_success_with_equal_value_using_comparer()
{
var a = Success(2);
var b = Success(2);
@ -112,7 +112,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_Result_ReturnsFalse_ForSuccessAndSuccessAndUnequalValue_WithComparer()
public void I_can_equal_result_and_get_false_for_success_and_success_with_unequal_value_using_comparer()
{
var a = Success(2);
var b = Success(3);
@ -121,7 +121,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_Result_ReturnsFalse_ForSuccessAndFailure_WithComparer()
public void I_can_equals_result_and_get_false_for_success_and_failure_using_comparer()
{
var a = Success(2);
var b = Failure<int>("error 1");
@ -130,7 +130,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_Result_ReturnsFalse_ForFailureAndSuccess_WithComparer()
public void I_can_equals_result_and_get_false_for_failure_and_success_using_comparer()
{
var a = Failure<int>("error");
var b = Success(2);
@ -139,7 +139,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void Equals_Result_ReturnsTrue_ForFailureAndFailure_WithComparer()
public void I_can_equals_result_and_get_true_for_failure_and_failure_using_comparer()
{
var a = Failure<int>("error 1");
var b = Failure<int>("error 2");
@ -148,7 +148,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void GetHashCode_ReturnsHashCode_ForSuccess()
public void I_can_get_hashcode_and_get_hashcode_for_success()
{
var result = Success(2);
@ -156,7 +156,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void GetHashCode_Returns_Zero_ForNull()
public void I_can_get_hashcode_and_get_zero_for_null()
{
var result = Success<string?>(null);
@ -164,7 +164,7 @@ internal sealed class ResultEqualityTests
}
[Test]
public void GetHashCode_Returns_Zero_ForFailure()
public void I_can_get_hashcode_and_get_zero_for_failure()
{
var result = Failure<int>("error");

View file

@ -4,7 +4,7 @@ namespace Geekeey.Extensions.Result.Tests;
internal sealed class ResultMatchingTests
{
[Test]
public void Match_CallsSuccessFunc_ForSuccess()
public void I_can_match_and_it_calls_success_func_for_success()
{
var result = Success(2);
var match = result.Match(
@ -15,7 +15,7 @@ internal sealed class ResultMatchingTests
}
[Test]
public void Match_CallsFailureFunc_ForFailure()
public void I_can_match_and_it_calls_failure_func_for_failure()
{
var result = Failure<int>("error");
var match = result.Match(
@ -26,7 +26,7 @@ internal sealed class ResultMatchingTests
}
[Test]
public void Switch_CallsSuccessAction_ForSuccess()
public void I_can_switch_and_it_calls_success_action_for_success()
{
var called = false;
@ -44,7 +44,7 @@ internal sealed class ResultMatchingTests
}
[Test]
public void Switch_CallsFailureAction_ForFailure()
public void I_can_switch_and_it_calls_failure_action_for_failure()
{
var called = false;
@ -62,7 +62,7 @@ internal sealed class ResultMatchingTests
}
[Test]
public async Task MatchAsync_CallsSuccessFunc_ForSuccess_Task()
public async Task I_can_match_async_and_it_calls_success_func_for_success()
{
var result = Success(2);
var match = await result.MatchAsync(
@ -73,7 +73,7 @@ internal sealed class ResultMatchingTests
}
[Test]
public async Task MatchAsync_CallsFailureFunc_ForFailure_Task()
public async Task I_can_match_async_and_it_calls_failure_func_for_failure()
{
var result = Failure<int>("error");
var match = await result.MatchAsync(
@ -84,7 +84,7 @@ internal sealed class ResultMatchingTests
}
[Test]
public async Task SwitchAsync_CallsSuccessAction_ForSuccess_Task()
public async Task I_can_switch_async_and_it_calls_success_action_for_success()
{
var called = false;
@ -103,7 +103,7 @@ internal sealed class ResultMatchingTests
}
[Test]
public async Task SwitchAsync_CallsFailureAction_ForFailure_Task()
public async Task I_can_switch_async_and_it_calls_failure_action_for_failure()
{
var called = false;
@ -122,7 +122,7 @@ internal sealed class ResultMatchingTests
}
[Test]
public async Task MatchAsync_CallsSuccessFunc_ForSuccess_ValueTask()
public async Task I_can_match_and_it_calls_success_func_for_success_ValueTask()
{
var result = Success(2);
var match = await result.MatchAsync(
@ -133,7 +133,7 @@ internal sealed class ResultMatchingTests
}
[Test]
public async Task MatchAsync_CallsFailureFunc_ForFailure_ValueTask()
public async Task I_can_match_async_and_it_calls_failure_func_for_failure_ValueTask()
{
var result = Failure<int>("error");
var match = await result.MatchAsync(
@ -144,7 +144,7 @@ internal sealed class ResultMatchingTests
}
[Test]
public async Task SwitchAsync_CallsSuccessAction_ForSuccess_ValueTask()
public async Task I_can_switch_async_and_it_calls_success_action_for_success_ValueTask()
{
var called = false;
@ -163,7 +163,7 @@ internal sealed class ResultMatchingTests
}
[Test]
public async Task SwitchAsync_CallsFailureAction_ForFailure_ValueTask()
public async Task I_can_switch_async_and_it_calls_failure_action_for_failure_ValueTask()
{
var called = false;

View file

@ -4,7 +4,7 @@ namespace Geekeey.Extensions.Result.Tests;
internal sealed class ResultTests
{
[Test]
public void New_T_HasValue()
public void I_can_create_new_success_result_from_t()
{
var result = new Result<int>(1);
@ -18,7 +18,7 @@ internal sealed class ResultTests
}
[Test]
public void New_Error_HasError()
public void I_can_create_new_failure_result_from_error()
{
var result = new Result<int>(new CustomTestError());
@ -32,7 +32,7 @@ internal sealed class ResultTests
}
[Test]
public void Default_IsDefault()
public void I_can_distinguish_default_result_from_created()
{
var result = default(Result<int>);
@ -46,7 +46,7 @@ internal sealed class ResultTests
}
[Test]
public void ToString_ReturnsSuccessString()
public void I_can_to_string_success_result_value()
{
Result<int> result = 2;
@ -54,7 +54,7 @@ internal sealed class ResultTests
}
[Test]
public void ToString_ReturnsFailureString()
public void I_can_to_string_failure_result_value()
{
Result<int> result = new StringError("error");

View file

@ -4,7 +4,7 @@ namespace Geekeey.Extensions.Result.Tests;
internal sealed class ResultTransformTests
{
[Test]
public void Map_ReturnsSuccess_ForSuccess()
public void I_can_map_and_it_returns_success_for_success()
{
var start = Success(2);
var result = start.Map(value => value.ToString());
@ -17,7 +17,7 @@ internal sealed class ResultTransformTests
}
[Test]
public void Map_ReturnsFailure_ForFailure()
public void I_can_map_and_it_returns_failure_for_failure()
{
var start = Failure<int>("error");
var result = start.Map(value => value.ToString());
@ -30,7 +30,7 @@ internal sealed class ResultTransformTests
}
[Test]
public void Then_ReturnsSuccess_ForSuccessAndMappingReturningSuccess()
public void I_can_transform_result_with_then_and_it_returns_success_for_success_and_mapping_returning_success()
{
var start = Success(2);
var result = start.Then(value => Success(value.ToString()));
@ -43,7 +43,7 @@ internal sealed class ResultTransformTests
}
[Test]
public void Then_ReturnsFailure_ForSuccessAndMappingReturningFailure()
public void I_can_transform_result_with_then_and_it_returns_failure_for_success_and_mapping_returning_failure()
{
var start = Success(2);
var result = start.Then(_ => Failure<string>("error"));
@ -56,7 +56,7 @@ internal sealed class ResultTransformTests
}
[Test]
public void Then_ReturnsFailure_ForFailureAndMappingReturningSuccess()
public void I_can_transform_result_with_then_and_it_returns_failure_for_failure_and_mapping_returning_success()
{
var start = Failure<int>("error");
var result = start.Then(value => Success(value.ToString()));
@ -69,7 +69,7 @@ internal sealed class ResultTransformTests
}
[Test]
public void Then_ReturnsFailure_ForFailureAndMappingReturningFailure()
public void I_can_transform_result_with_then_and_it_returns_failure_for_failure_and_mapping_returning_failure()
{
var start = Failure<int>("error");
var result = start.Then(_ => Failure<int>("error 2"));
@ -82,7 +82,7 @@ internal sealed class ResultTransformTests
}
[Test]
public void TryMap_ReturnsSuccess_ForSuccessWithoutThrowing()
public void I_can_try_map_and_it_returns_success_for_success_without_throwing()
{
var start = Success(2);
var result = start.TryMap(value => value.ToString());
@ -95,7 +95,7 @@ internal sealed class ResultTransformTests
}
[Test]
public void TryMap_ReturnsFailure_ForFailureWithoutThrowing()
public void I_can_try_map_and_it_returns_failure_for_failure_without_throwing()
{
var start = Failure<int>("error");
var result = start.TryMap(value => value.ToString());
@ -108,7 +108,7 @@ internal sealed class ResultTransformTests
}
[Test]
public void TryMap_ReturnsFailure_ForSuccessWithThrowing()
public void I_can_try_map_and_it_returns_failure_for_success_with_throwing()
{
var start = Success(2);
var result = start.TryMap<string>(_ => throw new CustomTestException());
@ -123,7 +123,7 @@ internal sealed class ResultTransformTests
}
[Test]
public void TryMap_ReturnsFailure_ForFailureWithThrowing()
public void I_can_try_map_and_it_returns_failure_for_failure_with_throwing()
{
var start = Failure<int>("error");
var result = start.TryMap<string>(_ => throw new CustomTestException());
@ -137,7 +137,7 @@ internal sealed class ResultTransformTests
}
[Test]
public void ThenTry_ReturnsSuccess_ForSuccessAndMappingReturningSuccess()
public void I_can_try_transform_result_with_then_and_it_returns_success_for_success_and_mapping_returning_success()
{
var start = Success(2);
var result = start.ThenTry(value => Success(value.ToString()));
@ -150,7 +150,7 @@ internal sealed class ResultTransformTests
}
[Test]
public void ThenTry_ReturnsFailure_ForSuccessAndMappingReturningFailure()
public void I_can_try_transform_result_with_then_and_it_returns_failure_for_success_and_mapping_returning_failure()
{
var start = Success(2);
var result = start.ThenTry(_ => Failure<string>("error"));
@ -163,7 +163,7 @@ internal sealed class ResultTransformTests
}
[Test]
public void ThenTry_ReturnsFailure_ForFailureAndMappingReturningFailure()
public void I_can_try_transform_result_with_then_and_it_returns_failure_for_failure_and_mapping_returning_failure()
{
var start = Failure<int>("error");
var result = start.ThenTry(x => Success(x.ToString()));
@ -176,7 +176,7 @@ internal sealed class ResultTransformTests
}
[Test]
public void ThenTry_ReturnsFailure_ForSuccessAndMappingThrowing()
public void I_can_try_transform_result_with_then_and_it_returns_failure_for_success_and_mapping_throwing()
{
var start = Success(2);
var result = start.ThenTry<string>(_ => throw new CustomTestException());
@ -191,7 +191,7 @@ internal sealed class ResultTransformTests
}
[Test]
public void ThenTry_ReturnsFailure_ForFailureAndMappingThrowing()
public void I_can_try_transform_result_with_then_and_it_returns_failure_for_failure_and_mapping_throwing()
{
var start = Failure<int>("error");
var result = start.ThenTry<string>(_ => throw new CustomTestException());
@ -205,7 +205,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task MapAsync_ReturnsSuccess_ForSuccess_Task()
public async Task I_can_map_async_and_it_returns_success_for_success()
{
var start = Success(2);
var result = await start.MapAsync(value => Task.FromResult(value.ToString()));
@ -218,7 +218,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task MapAsync_ReturnsFailure_ForFailure_Task()
public async Task I_can_map_async_and_it_returns_failure_for_failure()
{
var start = Failure<int>("error");
var result = await start.MapAsync(value => Task.FromResult(value.ToString()));
@ -231,7 +231,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenAsync_ReturnsSuccess_ForSuccessAndMappingReturningSuccess_Task()
public async Task I_can_transform_result_async_with_then_and_it_returns_success_for_success_and_mapping_returning_success()
{
var start = Success(2);
var result = await start.ThenAsync(value => Task.FromResult(Success(value.ToString())));
@ -244,7 +244,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenAsync_ReturnsFailure_ForSuccessAndMappingReturningFailure_Task()
public async Task I_can_transform_result_async_with_then_and_it_returns_failure_for_success_and_mapping_returning_failure()
{
var start = Success(2);
var result = await start.ThenAsync(_ => Task.FromResult(Failure<string>("error")));
@ -257,7 +257,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenAsync_ReturnsFailure_ForFailureAndMappingReturningSuccess_Task()
public async Task I_can_transform_result_async_with_then_and_it_returns_failure_for_failure_and_mapping_returning_success()
{
var start = Failure<int>("error");
var result = await start.ThenAsync(value => Task.FromResult(Success(value.ToString())));
@ -270,7 +270,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenAsync_ReturnsFailure_ForFailureAndMappingReturningFailure_Task()
public async Task I_can_transform_result_async_with_then_and_it_returns_failure_for_failure_and_mapping_returning_failure()
{
var start = Failure<int>("error");
var result = await start.ThenAsync(_ => Task.FromResult(Failure<int>("error 2")));
@ -283,7 +283,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task TryMapAsync_ReturnsSuccess_ForSuccessWithoutThrowing_Task()
public async Task I_can_try_map_async_and_it_returns_success_for_success_without_throwing()
{
var start = Success(2);
var result = await start.TryMapAsync(value => Task.FromResult(value.ToString()));
@ -296,7 +296,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task TryMapAsync_ReturnsFailure_ForFailureWithoutThrowing_Task()
public async Task I_can_try_map_async_and_it_returns_failure_for_failure_without_throwing()
{
var start = Failure<int>("error");
var result = await start.TryMapAsync(value => Task.FromResult(value.ToString()));
@ -309,7 +309,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task TryMapAsync_ReturnsFailure_ForSuccessWithThrowing_Task()
public async Task I_can_try_map_async_and_it_returns_failure_for_success_with_throwing()
{
var start = Success(2);
var result = await start.TryMapAsync(Task<string> (_) => throw new CustomTestException());
@ -324,7 +324,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task TryMapAsync_ReturnsFailure_ForSuccessWithAwaitThrowing_Task()
public async Task I_can_try_map_async_and_it_returns_failure_for_success_with_await_throwing()
{
var start = Success(2);
var result = await start.TryMapAsync(async Task<string> (_) =>
@ -343,7 +343,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task TryMapAsync_ReturnsFailure_ForFailureWithThrowing_Task()
public async Task I_can_try_map_async_and_it_returns_failure_for_failure_with_throwing()
{
var start = Failure<int>("error");
var result = await start.TryMapAsync(Task<string> (_) => throw new CustomTestException());
@ -357,7 +357,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task TryMapAsync_ReturnsFailure_ForFailureWithAwaitThrowing_Task()
public async Task I_can_try_map_async_and_it_returns_failure_for_failure_with_await_throwing()
{
var start = Failure<int>("error");
var result = await start.TryMapAsync(async Task<string> (_) =>
@ -375,7 +375,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenTryAsync_ReturnsSuccess_ForSuccessAndMappingReturningSuccess_Task()
public async Task I_can_try_transform_result_async_with_then_and_it_returns_success_for_success_and_mapping_returning_success()
{
var start = Success(2);
var result = await start.ThenTryAsync(value => Task.FromResult(Success(value.ToString())));
@ -388,7 +388,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenTryAsync_ReturnsFailure_ForSuccessAndMappingReturningFailure_Task()
public async Task I_can_try_transform_result_async_with_then_and_it_returns_failure_for_success_and_mapping_returning_failure()
{
var start = Success(2);
var result = await start.ThenTryAsync(_ => Task.FromResult(Failure<string>("error")));
@ -401,7 +401,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenTryAsync_ReturnsFailure_ForFailureAndMappingReturningFailure_Task()
public async Task I_can_try_transform_result_async_with_then_and_it_returns_failure_for_failure_and_mapping_returning_failure()
{
var start = Failure<int>("error");
var result = await start.ThenTryAsync(x => Task.FromResult(Success(x.ToString())));
@ -414,7 +414,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenTryAsync_ReturnsFailure_ForSuccessAndMappingThrowing_Task()
public async Task I_can_try_transform_result_async_with_then_and_it_returns_failure_for_success_and_mapping_throwing()
{
var start = Success(2);
var result = await start.ThenTryAsync(Task<Result<string>> (_) => throw new CustomTestException());
@ -429,7 +429,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenTryAsync_ReturnsFailure_ForSuccessAndMappingAwaitThrowing_Task()
public async Task I_can_try_transform_result_async_with_then_and_it_returns_failure_for_success_and_mapping_await_throwing()
{
var start = Success(2);
var result = await start.ThenTryAsync(async Task<Result<string>> (_) =>
@ -448,7 +448,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenTryAsync_ReturnsFailure_ForFailureAndMappingThrowing_Task()
public async Task I_can_try_transform_result_async_with_then_and_it_returns_failure_for_failure_and_mapping_throwing()
{
var start = Failure<int>("error");
var result = await start.ThenTryAsync(Task<Result<string>> (_) => throw new CustomTestException());
@ -462,7 +462,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenTryAsync_ReturnsFailure_ForFailureAndMappingAwaitThrowing_Task()
public async Task I_can_try_transform_result_async_with_then_and_it_returns_failure_for_failure_and_mapping_await_throwing()
{
var start = Failure<int>("error");
var result = await start.ThenTryAsync(async Task<Result<string>> (_) =>
@ -480,7 +480,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task MapAsync_ReturnsSuccess_ForSuccess_ValueTask()
public async Task I_can_map_async_and_it_returns_success_for_success_ValueTask()
{
var start = Success(2);
var result = await start.MapAsync(value => ValueTask.FromResult(value.ToString()));
@ -493,7 +493,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task MapAsync_ReturnsFailure_ForFailure_ValueTask()
public async Task I_can_map_async_and_it_returns_failure_for_failure_ValueTask()
{
var start = Failure<int>("error");
var result = await start.MapAsync(value => ValueTask.FromResult(value.ToString()));
@ -506,7 +506,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenAsync_ReturnsSuccess_ForSuccessAndMappingReturningSuccess_ValueTask()
public async Task I_can_transform_result_async_with_then_and_it_returns_success_for_success_and_mapping_returning_success_ValueTask()
{
var start = Success(2);
var result = await start.ThenAsync(value => ValueTask.FromResult(Success(value.ToString())));
@ -519,7 +519,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenAsync_ReturnsFailure_ForSuccessAndMappingReturningFailure_ValueTask()
public async Task I_can_transform_result_async_with_then_and_it_returns_failure_for_success_and_mapping_returning_failure_ValueTask()
{
var start = Success(2);
var result = await start.ThenAsync(_ => ValueTask.FromResult(Failure<string>("error")));
@ -532,7 +532,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenAsync_ReturnsFailure_ForFailureAndMappingReturningSuccess_ValueTask()
public async Task I_can_transform_result_async_with_then_and_it_returns_failure_for_failure_and_mapping_returning_success_ValueTask()
{
var start = Failure<int>("error");
var result = await start.ThenAsync(value => ValueTask.FromResult(Success(value.ToString())));
@ -545,7 +545,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenAsync_ReturnsFailure_ForFailureAndMappingReturningFailure_ValueTask()
public async Task I_can_transform_result_async_with_then_and_it_returns_failure_for_failure_and_mapping_returning_failure_ValueTask()
{
var start = Failure<int>("error");
var result = await start.ThenAsync(_ => ValueTask.FromResult(Failure<int>("error 2")));
@ -558,7 +558,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task TryMapAsync_ReturnsSuccess_ForSuccessWithoutThrowing_ValueTask()
public async Task I_can_try_map_async_and_it_returns_success_for_success_without_throwing_ValueTask()
{
var start = Success(2);
var result = await start.TryMapAsync(value => ValueTask.FromResult(value.ToString()));
@ -571,7 +571,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task TryMapAsync_ReturnsFailure_ForFailureWithoutThrowing_ValueTask()
public async Task I_can_try_map_async_and_it_returns_failure_for_failure_without_throwing_ValueTask()
{
var start = Failure<int>("error");
var result = await start.TryMapAsync(value => ValueTask.FromResult(value.ToString()));
@ -584,7 +584,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task TryMapAsync_ReturnsFailure_ForSuccessWithThrowing_ValueTask()
public async Task I_can_try_map_async_and_it_returns_failure_for_success_with_throwing_ValueTask()
{
var start = Success(2);
var result = await start.TryMapAsync(ValueTask<string> (_) => throw new CustomTestException());
@ -599,7 +599,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task TryMapAsync_ReturnsFailure_ForSuccessWithAwaitThrowing_ValueTask()
public async Task I_can_try_map_async_and_it_returns_failure_for_success_with_await_throwing_ValueTask()
{
var start = Success(2);
var result = await start.TryMapAsync(async ValueTask<string> (_) =>
@ -618,7 +618,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task TryMapAsync_ReturnsFailure_ForFailureWithThrowing_ValueTask()
public async Task I_can_try_map_async_and_it_returns_failure_for_failure_with_throwing_ValueTask()
{
var start = Failure<int>("error");
var result = await start.TryMapAsync(ValueTask<string> (_) => throw new CustomTestException());
@ -632,7 +632,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task TryMapAsync_ReturnsFailure_ForFailureWithAwaitThrowing_ValueTask()
public async Task I_can_try_map_async_and_it_returns_failure_for_failure_with_await_throwing_ValueTask()
{
var start = Failure<int>("error");
var result = await start.TryMapAsync(async ValueTask<string> (_) =>
@ -650,7 +650,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenTryAsync_ReturnsSuccess_ForSuccessAndMappingReturningSuccess_ValueTask()
public async Task I_can_try_transform_result_async_with_then_and_it_returns_success_for_success_and_mapping_returning_success_ValueTask()
{
var start = Success(2);
var result = await start.ThenTryAsync(value => ValueTask.FromResult(Success(value.ToString())));
@ -663,7 +663,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenTryAsync_ReturnsFailure_ForSuccessAndMappingReturningFailure_ValueTask()
public async Task I_can_try_transform_result_async_with_then_and_it_returns_failure_for_success_and_mapping_returning_failure_ValueTask()
{
var start = Success(2);
var result = await start.ThenTryAsync(_ => ValueTask.FromResult(Failure<string>("error")));
@ -676,7 +676,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenTryAsync_ReturnsFailure_ForFailureAndMappingReturningFailure_ValueTask()
public async Task I_can_try_transform_result_async_with_then_and_it_returns_failure_for_failure_and_mapping_returning_failure_ValueTask()
{
var start = Failure<int>("error");
var result = await start.ThenTryAsync(x => ValueTask.FromResult(Success(x.ToString())));
@ -689,7 +689,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenTryAsync_ReturnsFailure_ForSuccessAndMappingThrowing_ValueTask()
public async Task I_can_try_transform_result_async_with_then_and_it_returns_failure_for_success_and_mapping_throwing_ValueTask()
{
var start = Success(2);
var result = await start.ThenTryAsync(ValueTask<Result<string>> (_) => throw new CustomTestException());
@ -704,7 +704,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenTryAsync_ReturnsFailure_ForSuccessAndMappingAwaitThrowing_ValueTask()
public async Task I_can_try_transform_result_async_with_then_and_it_returns_failure_for_success_and_mapping_await_throwing_ValueTask()
{
var start = Success(2);
var result = await start.ThenTryAsync(async ValueTask<Result<string>> (_) =>
@ -723,7 +723,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenTryAsync_ReturnsFailure_ForFailureAndMappingThrowing_ValueTask()
public async Task I_can_try_transform_result_async_with_then_and_it_returns_failure_for_failure_and_mapping_throwing_ValueTask()
{
var start = Failure<int>("error");
var result = await start.ThenTryAsync(ValueTask<Result<string>> (_) => throw new CustomTestException());
@ -737,7 +737,7 @@ internal sealed class ResultTransformTests
}
[Test]
public async Task ThenTryAsync_ReturnsFailure_ForFailureAndMappingAwaitThrowing_ValueTask()
public async Task I_can_try_transform_result_async_with_then_and_it_returns_failure_for_failure_and_mapping_await_throwing_ValueTask()
{
var start = Failure<int>("error");
var result = await start.ThenTryAsync(async ValueTask<Result<string>> (_) =>

View file

@ -4,7 +4,7 @@ namespace Geekeey.Extensions.Result.Tests;
internal sealed class ResultUnboxTests
{
[Test]
public void TryGetValue_1_ReturnsTrueAndSetsValue_ForSuccess()
public void I_can_try_get_value_and_it_returns_true_and_sets_value_for_success_with_1_param()
{
var result = Success(2);
var ok = result.TryGetValue(out var value);
@ -17,7 +17,7 @@ internal sealed class ResultUnboxTests
}
[Test]
public void TryGetValue_1_ReturnsFalse_ForFailure()
public void I_can_try_get_value_and_it_returns_false_for_failure_with_1_param()
{
var result = Failure<int>("error");
var ok = result.TryGetValue(out var value);
@ -30,7 +30,7 @@ internal sealed class ResultUnboxTests
}
[Test]
public void TryGetValue_2_ReturnsTrueAndSetsValue_ForSuccess()
public void I_can_try_get_value_and_it_returns_true_and_sets_value_for_success_with_2_param()
{
var result = Success(2);
var ok = result.TryGetValue(out var value, out var error);
@ -44,7 +44,7 @@ internal sealed class ResultUnboxTests
}
[Test]
public void TryGetValue_2_ReturnsFalseAndSetsError_ForFailure()
public void I_can_try_get_value_and_it_returns_false_and_sets_error_for_failure_with_2_param()
{
var result = Failure<int>("error");
var ok = result.TryGetValue(out var value, out var error);
@ -58,7 +58,7 @@ internal sealed class ResultUnboxTests
}
[Test]
public void TryGetError_1_ReturnsTrueAndSetsError_ForFailure()
public void I_can_try_get_error_and_it_returns_true_and_sets_error_for_failure_with_1_param()
{
var result = Failure<int>("error");
var ok = result.TryGetError(out var error);
@ -71,7 +71,7 @@ internal sealed class ResultUnboxTests
}
[Test]
public void TryGetError_1_ReturnsFalse_ForSuccess()
public void I_can_try_get_error_and_it_returns_false_for_success_with_1_param()
{
var result = Success(2);
var ok = result.TryGetError(out var error);
@ -84,7 +84,7 @@ internal sealed class ResultUnboxTests
}
[Test]
public void TryGetError_2_ReturnsTrueAndSetsError_ForFailure()
public void I_can_try_get_error_and_it_returns_true_and_sets_error_for_failure_with_2_param()
{
var r = Failure<int>("error");
var ok = r.TryGetError(out var error, out var value);
@ -98,7 +98,7 @@ internal sealed class ResultUnboxTests
}
[Test]
public void TryGetError_2_ReturnsFalseAndSetsValue_ForSuccess()
public void I_can_try_get_error_and_it_returns_false_and_sets_value_for_success_with_2_param()
{
var r = Success(2);
var ok = r.TryGetError(out var error, out var value);

View file

@ -9,6 +9,6 @@
<ItemGroup>
<None Include=".\package-readme.md" Pack="true" PackagePath="\" />
<None Include="Project.props" Pack="true" PackagePath="build\$(AssemblyName).props" />
<None Include="Project.props" Pack="true" PackagePath="build\$(PackageId).props" />
</ItemGroup>
</Project>