public static bool EqualsTests(string leftVal, string rightVal) { var left = OptionTests.MakeOption(leftVal); var right = OptionTests.MakeOption(rightVal); return(left.Equals(right)); }
public static string BindTests(string val, bool returnValue) { return(OptionTests .MakeOption(val) .Pipe(Option.Bind <string, int>(x => returnValue ? Option.Some(x.Length) : Option.None <int>())) .ToString()); }
public static string OrTests(string leftVal, string rightVal) { var left = OptionTests.MakeOption(leftVal); var right = OptionTests.MakeOption(rightVal); return((left || right).ToString()); }
public static string ToEitherRightTests(string val, int rightValue) { return(OptionTests .MakeOption(val) .ToEitherRight(rightValue) .ToString()); }
public static string WhereTests(string val) { return((from x in OptionTests.MakeOption(val) where x == "B" select x.Length) .ToString()); }
public static string MapTests(string val) { return(OptionTests .MakeOption(val) .Pipe(Option.Map <string, string>(x => x.ToLower())) .ToString()); }
public static string FilterTests(string val) { return(OptionTests .MakeOption(val) .Pipe(Option.Filter <string>(x => x == "B")) .ToString()); }
public static string OfTypeTests(string val, bool wrapValue) { var innerOption = OptionTests.MakeOption(val); return((wrapValue ? innerOption.ToOption() : Option.None <Option <string> >()) .Pipe(Option.OfType <Option <string>, OptionSome <string> >()) .ToString()); }
public static string MatchTests(string val) { return(OptionTests .MakeOption(val) .Pipe(Option.Match <string, string>( x => $"Just: {x}", () => "Nothing"))); }
public static string SelectManyTests(string val, bool returnSome) { return((from x in OptionTests.MakeOption(val) from y in returnSome ? Option.None <bool>() : (x.Length == 0).ToOption() select y) .ToString()); }
public static string ToStringTests(string val) { return(OptionTests.MakeOption(val).ToString()); }
public static bool IsEmptyTests(string val) { return(OptionTests.MakeOption(val).IsEmpty); }
public static object GetEnumeratorTests(string val) { var enumerator = ((IEnumerable)OptionTests.MakeOption(val)).GetEnumerator(); return(enumerator.MoveNext() ? enumerator.Current : null); }
public static string SelectTests(string val) { return((from x in OptionTests.MakeOption(val) select x.Length) .ToString()); }
public static string DefaultWithTests(string val) { return(OptionTests .MakeOption(val) .Pipe(Option.DefaultWith("B"))); }