Esempio n. 1
0
            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));
            }
Esempio n. 2
0
            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));
            }
Esempio n. 3
0
            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));
            }
Esempio n. 4
0
            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));
            }
Esempio n. 5
0
            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)));
            }
Esempio n. 6
0
 public static async Task OrElseAsync_SomeInt32_Sync() =>
 await Assert.Async.Some(1, MaybeEx.OrElseAsync(One, ReturnSync_(3)));
Esempio n. 7
0
 public static async Task OrElseAsync_Some_Sync()
 {
     var anyT = AnyT.New();
     await Assert.Async.Some(anyT.Value, MaybeEx.OrElseAsync(anyT.Some, ReturnSync_(AnyT.Value)));
 }
Esempio n. 8
0
            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 !));
            }
Esempio n. 9
0
 public static async Task SelectAsync_SomeUri_Sync() =>
 await Assert.Async.Some(MyUri.AbsoluteUri,
                         MaybeEx.SelectAsync(SomeUri, GetAbsoluteUriSync));
Esempio n. 10
0
 public static async Task SelectAsync_SomeInt64_Sync() =>
 await Assert.Async.Some(8L, MaybeEx.SelectAsync(TwoL, Times4Sync));
Esempio n. 11
0
            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));
            }
Esempio n. 12
0
 public static async Task BindAsync_SomeUri() =>
 await Assert.Async.Some(MyUri.AbsoluteUri,
                         MaybeEx.BindAsync(SomeUri, GetAbsoluteUriAsync_));
Esempio n. 13
0
 public static async Task BindAsync_SomeInt64_Sync() =>
 await Assert.Async.Some(8L, MaybeEx.BindAsync(TwoL, Times4Sync_));
Esempio n. 14
0
 public static async Task BindAsync_SomeInt32_Sync() =>
 await Assert.Async.Some(6, MaybeEx.BindAsync(Two, Times3Sync_));
Esempio n. 15
0
 public static async Task OrElseAsync_SomeText_Sync() =>
 await Assert.Async.Some(MyText, MaybeEx.OrElseAsync(SomeText, ReturnSync_("other")));
Esempio n. 16
0
 public static async Task SelectAsync_SomeInt32_Sync() =>
 await Assert.Async.Some(6, MaybeEx.SelectAsync(Two, Times3Sync));
Esempio n. 17
0
 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)));
 }
Esempio n. 18
0
            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));
            }