public void Passing_Null_Function__Throws_ArgumentNullException() { Assert.Throws <ArgumentNullException>(() => { Func <string, IAsyncMaybe <bool> > function = null; AsyncMaybe.Value("foo").FlatMapAsync(function); }); }
ResultSelector_Overload__Flattening_From_String_Maybe_With_value_To_String_Maybe_Without_Value__Expects_String_Maybe_Without_Value() { const string input = "hello"; await AsyncMaybe.Value(input) .FlatMapAsync(x => AsyncMaybe.None <string>(), (x, y) => x.Length + y.Length); }
Maybe_String_Whose_Property_HasValue_Is_True_Flatmapping_Some__Pasing_Null_ResultSelector__ArgumentNullReferenceException_Thrown() { Assert.Throws <ArgumentNullException>(() => { Func <string, string, string> resultSelector = null; AsyncMaybe.Value("foo").FlatMapAsync(AsyncMaybe.Value, resultSelector); }); }
Maybe_String_Whose_Property_HasValue_Is_True__Pasing_Null_Selector__ArgumentNullReferenceException_Thrown() { Assert.Throws <ArgumentNullException>(() => { Func <string, IAsyncMaybe <string> > selector = null; AsyncMaybe.Value("foo").FlatMapAsync(selector); }); }
Flattening_From_String_Maybe_With_value_To_String_Maybe_Without_Value__Expects_String_Maybe_Without_Value() { const string input = "hello"; await AsyncMaybe.Value(input) .FlatMapAsync(x => AsyncMaybe.None <int>()) .AssertNone(); }
ResultSelector_Overload__Flattening_From_String_Maybe_With_value_To_Nullable_Int_Without_Value__Expects_String_Maybe_Without_Value() { const string input = "hello"; int? nullableInt = null; await AsyncMaybe.Value(input) .FlatMapAsync(async x => { await AssertionUtilities.Delay; return(nullableInt); }, (x, y) => x.Length + y) .AssertNone(); }
Flattening_From_String_Maybe_With_value_To_Nullable_Int_With_Value__Expects_String_Maybe_With_Value() { const string input = "hello"; int? nullabelInt = 2; await AsyncMaybe.Value(input) .FlatMapAsync(async x => { await AssertionUtilities.Delay; return(nullabelInt); }) .AssertValue(nullabelInt.Value); }