Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected static async Task Test00(Func<Maybe<object?>, Func<Task<Maybe<object?>
var some = F.Some<object>(null, true);
var none = F.None<object?, NullValueMsg>();
var throws = Substitute.For<Func<Task<Maybe<object?>>>>();
throws.Invoke().Throws<Exception>();
throws.Invoke().ThrowsAsync<Exception>();

// Act
var r0 = await act(some, throws);
Expand Down Expand Up @@ -194,8 +194,7 @@ protected static async Task Test10(Func<Maybe<Guid?>, Func<Task<string>>, Func<G
var ifNull = Substitute.For<Func<Task<string>>>();
var message = Rnd.Str;
var ex = new Exception(message);
ifNull.Invoke()
.Throws(ex);
ifNull.Invoke().ThrowsAsync(ex);
var ifSome = Substitute.For<Func<Guid?, Task<string>>>();
var handler = Substitute.For<F.Handler>();

Expand All @@ -220,8 +219,7 @@ protected static async Task Test11(Func<Maybe<Guid?>, Func<Task<string>>, Func<G
var ifSome = Substitute.For<Func<Guid?, Task<string>>>();
var message = Rnd.Str;
var ex = new Exception(message);
ifSome.Invoke(value)
.Throws(ex);
ifSome.Invoke(value).ThrowsAsync(ex);
var handler = Substitute.For<F.Handler>();

// Act
Expand All @@ -240,8 +238,7 @@ protected static async Task Test12(Func<Maybe<Guid?>, Func<Task<Maybe<string>>>,
var some = F.Some<Guid?>(() => null, true, F.DefaultHandler);
var none = F.None<Guid?, NullValueMsg>();
var ifNull = Substitute.For<Func<Task<Maybe<string>>>>();
ifNull.Invoke()
.Throws(new Exception());
ifNull.Invoke().ThrowsAsync(new Exception());
var ifSome = Substitute.For<Func<Guid?, Task<Maybe<string>>>>();

// Act
Expand All @@ -263,8 +260,7 @@ protected static async Task Test13(Func<Maybe<Guid?>, Func<Task<Maybe<string>>>,
var none = F.None<Guid?, NullValueMsg>();
var ifNull = Substitute.For<Func<Task<Maybe<string>>>>();
var ifSome = Substitute.For<Func<Guid?, Task<Maybe<string>>>>();
ifSome.Invoke(value)
.Throws(new Exception());
ifSome.Invoke(value).ThrowsAsync(new Exception());

// Act
var result = await act(some, ifNull, ifSome);
Expand Down
2 changes: 1 addition & 1 deletion tests/Tests.MaybeF/Functions/IfNull/IfNullAsync_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public override async Task Test00_Exception_In_NullValue_Func_Returns_None_With_
{
await Test00((mbe, ifNull) => F.IfNullAsync(mbe, ifNull));
await Test00((mbe, ifNull) => F.IfNullAsync(mbe.AsTask(), ifNull));
await Test00((mbe, ifNull) => F.IfNullAsync(mbe.AsTask(), () => { ifNull(); return new TestMsg(); }));
await Test00((mbe, ifNull) => F.IfNullAsync(mbe.AsTask(), () => { ifNull().GetAwaiter().GetResult(); return new TestMsg(); }));
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public override async Task Test00_Exception_In_NullValue_Func_Returns_None_With_
{
await Test00((mbe, ifNull) => mbe.AsTask().IfNullAsync(ifNull));
await Test00((mbe, ifNull) => mbe.AsTask().IfNullAsync(() => ifNull().GetAwaiter().GetResult()));
await Test00((mbe, ifNull) => mbe.AsTask().IfNullAsync(() => { ifNull(); return new TestMsg(); }));
await Test00((mbe, ifNull) => mbe.AsTask().IfNullAsync(() => { ifNull().GetAwaiter().GetResult(); return new TestMsg(); }));
}

[Fact]
Expand Down