public static void Parse6b() { var value = "IBAN AL47212110090000000235698741"; Assert.NotNull(Iban.Parse(value, IbanStyles.AllowHeader)); Assert.True(Iban.TryParse(value, IbanStyles.AllowHeader).IsSuccess); }
public static void OfRight1() { var either = Either <Obj, Obj> .OfRight(new Obj("left")); Assert.NotNull(either); Assert.True(either.IsRight); Assert.False(either.IsLeft); }
public static void cast6() { var exp = new Obj("right"); var either = (Either <string, Obj>)exp; Assert.NotNull(either); Assert.True(either.IsRight); Assert.True(either.ContainsRight(exp)); }
public static void cast5() { var exp = new Obj("left"); var either = (Either <Obj, string>)exp; Assert.NotNull(either); Assert.True(either.IsLeft); Assert.True(either.ContainsLeft(exp)); }
public static void ThrowIfError2() { var nok = Fallible.FromError(Error); var ex = Record.Exception(() => nok.ThrowIfError()); Assert.NotNull(ex); Assert.IsType <SimpleException>(ex); Assert.Equal(ErrorMessage, ex.Message); }
public static void ThrowIfError2() { var error = "My message"; var nok = Result <Obj, SimpleException> .FromError(new SimpleException(error)); var ex = Record.Exception(() => nok.ThrowIfError()); Assert.NotNull(ex); Assert.IsType <SimpleException>(ex); Assert.Equal(error, ex.Message); }
public static void ValueOrThrow_Throws_IfError() { var nok = Fallible <Obj> .FromError(Error); Action act = () => nok.ValueOrThrow(); var ex = Record.Exception(act); Assert.NotNull(ex); Assert.IsType <SimpleException>(ex); Assert.Equal(ErrorMessage, ex.Message); }
public static void State3() { var message = "My message"; Action act = () => Require.State(false, message); var ex = Record.Exception(act); Assert.NotNull(ex); Assert.IsType <InvalidOperationException>(ex); Assert.Equal(message, ex.Message); }
public static void True2() { var paramName = "paramName"; Action act = () => Require.True(false, paramName); var ex = Record.Exception(act); Assert.NotNull(ex); Assert.NotNull(ex.Message); var argex = Assert.IsType <ArgumentException>(ex); Assert.Equal(paramName, argex.ParamName); }
public static void NotNullOrWhiteSpace4() { var paramName = "paramName"; Action act = () => Require.NotNullOrWhiteSpace(" ", paramName); var ex = Record.Exception(act); Assert.NotNull(ex); Assert.NotNull(ex.Message); var argex = Assert.IsType <ArgumentException>(ex); Assert.Equal(paramName, argex.ParamName); }
public static void NotNullUnconstrained2() { Object obj = null; var paramName = "paramName"; Action act = () => Require.NotNullUnconstrained(obj, paramName); var ex = Record.Exception(act); Assert.NotNull(ex); Assert.NotNull(ex.Message); var argex = Assert.IsType <ArgumentNullException>(ex); Assert.Equal(paramName, argex.ParamName); }
public static void True3() { var paramName = "paramName"; var message = "My message"; Action act = () => Require.True(false, paramName, message); var ex = Record.Exception(act); Assert.NotNull(ex); var argex = Assert.IsType <ArgumentException>(ex); Assert.Equal(paramName, argex.ParamName); // ArgumentException appends some info to our message. Assert.StartsWith(message, ex.Message, StringComparison.OrdinalIgnoreCase); }
public static void Parse7b(string value) { Assert.NotNull(Iban.Parse(value, IbanStyles.Any)); Assert.True(Iban.TryParse(value, IbanStyles.Any).IsSuccess); }
public static void Parse5(string value) { Assert.NotNull(Iban.Parse(value, IbanStyles.AllowLowercaseLetter)); Assert.True(Iban.TryParse(value, IbanStyles.AllowLowercaseLetter).IsSuccess); }
public static void Parse4f(string value) { Assert.NotNull(Iban.Parse(value, IbanStyles.AllowInnerWhite)); Assert.True(Iban.TryParse(value, IbanStyles.AllowInnerWhite).IsSuccess); }
public static void Parse3(string value) { Assert.NotNull(Iban.Parse(value)); Assert.True(Iban.TryParse(value).IsSuccess); }