public static async Task BindAsync_None_Sync() { await Assert.Async.None(MaybeEx.BindAsync(Ø, Kunc <int, AnyResult> .AnySync)); await Assert.Async.None(MaybeEx.BindAsync(NoText, Kunc <string, AnyResult> .AnySync)); await Assert.Async.None(MaybeEx.BindAsync(NoUri, Kunc <Uri, AnyResult> .AnySync)); await Assert.Async.None(MaybeEx.BindAsync(AnyT.None, Kunc <AnyT, AnyResult> .AnySync)); }
public static async Task BindAsync_Some_WithBinderReturningSome_Sync() { await Assert.Async.Some(AnyResult.Value, MaybeEx.BindAsync(One, ReturnSomeSync)); await Assert.Async.Some(AnyResult.Value, MaybeEx.BindAsync(SomeText, ReturnSomeSync)); await Assert.Async.Some(AnyResult.Value, MaybeEx.BindAsync(SomeUri, ReturnSomeSync)); await Assert.Async.Some(AnyResult.Value, MaybeEx.BindAsync(AnyT.Some, ReturnSomeSync)); }
public static async Task SelectAsync_None_Sync() { await Assert.Async.None(MaybeEx.SelectAsync(Ø, Funk <int, AnyResult> .AnySync)); await Assert.Async.None(MaybeEx.SelectAsync(NoText, Funk <string, AnyResult> .AnySync)); await Assert.Async.None(MaybeEx.SelectAsync(NoUri, Funk <Uri, AnyResult> .AnySync)); await Assert.Async.None(MaybeEx.SelectAsync(AnyT.None, Funk <AnyT, AnyResult> .AnySync)); }
public static async Task BindAsync_Some_WithBinderReturningNone_Sync() { await Assert.Async.None(MaybeEx.BindAsync(One, ReturnNoneSync)); await Assert.Async.None(MaybeEx.BindAsync(SomeText, ReturnNoneSync)); await Assert.Async.None(MaybeEx.BindAsync(SomeUri, ReturnNoneSync)); await Assert.Async.None(MaybeEx.BindAsync(AnyT.Some, ReturnNoneSync)); }
public static async Task OrElseAsync_None_Sync() { await Assert.Async.Some(3, MaybeEx.OrElseAsync(Ø, ReturnSync_(3))); await Assert.Async.Some("other", MaybeEx.OrElseAsync(NoText, ReturnSync_("other"))); var otherUri = new Uri("https://source.dot.net/"); await Assert.Async.Some(otherUri, MaybeEx.OrElseAsync(NoUri, ReturnSync_(otherUri))); var otherAnyT = AnyT.Value; await Assert.Async.Some(otherAnyT, MaybeEx.OrElseAsync(AnyT.None, ReturnSync_(otherAnyT))); }
public static async Task OrElseAsync_SomeInt32_Sync() => await Assert.Async.Some(1, MaybeEx.OrElseAsync(One, ReturnSync_(3)));
public static async Task OrElseAsync_Some_Sync() { var anyT = AnyT.New(); await Assert.Async.Some(anyT.Value, MaybeEx.OrElseAsync(anyT.Some, ReturnSync_(AnyT.Value))); }
public static async Task OrElseAsync_Some_WithNullOther() { await Assert.Async.ThrowsAnexn("other", () => MaybeEx.OrElseAsync(One, null !)); await Assert.Async.ThrowsAnexn("other", () => MaybeEx.OrElseAsync(AnyT.Some, null !)); }
public static async Task SelectAsync_SomeUri_Sync() => await Assert.Async.Some(MyUri.AbsoluteUri, MaybeEx.SelectAsync(SomeUri, GetAbsoluteUriSync));
public static async Task SelectAsync_SomeInt64_Sync() => await Assert.Async.Some(8L, MaybeEx.SelectAsync(TwoL, Times4Sync));
public static async Task SelectAsync_Some_WithNullSelector() { await Assert.Async.ThrowsAnexn("selector", () => MaybeEx.SelectAsync(One, Funk <int, AnyResult> .NullAsync)); await Assert.Async.ThrowsAnexn("selector", () => MaybeEx.SelectAsync(AnyT.Some, Funk <AnyT, AnyResult> .NullAsync)); }
public static async Task BindAsync_SomeUri() => await Assert.Async.Some(MyUri.AbsoluteUri, MaybeEx.BindAsync(SomeUri, GetAbsoluteUriAsync_));
public static async Task BindAsync_SomeInt64_Sync() => await Assert.Async.Some(8L, MaybeEx.BindAsync(TwoL, Times4Sync_));
public static async Task BindAsync_SomeInt32_Sync() => await Assert.Async.Some(6, MaybeEx.BindAsync(Two, Times3Sync_));
public static async Task OrElseAsync_SomeText_Sync() => await Assert.Async.Some(MyText, MaybeEx.OrElseAsync(SomeText, ReturnSync_("other")));
public static async Task SelectAsync_SomeInt32_Sync() => await Assert.Async.Some(6, MaybeEx.SelectAsync(Two, Times3Sync));
public static async Task OrElseAsync_SomeUri_Sync() { var otherUri = new Uri("https://source.dot.net/"); await Assert.Async.Some(MyUri, MaybeEx.OrElseAsync(SomeUri, ReturnSync_(otherUri))); }
public static async Task BindAsync_Some_WithNullBinder() { await Assert.Async.ThrowsAnexn("binder", () => MaybeEx.BindAsync(One, Kunc <int, AnyResult> .NullAsync)); await Assert.Async.ThrowsAnexn("binder", () => MaybeEx.BindAsync(AnyT.Some, Kunc <AnyT, AnyResult> .NullAsync)); }