Exemple #1
0
        public static void TryParse3(string value)
        {
            var result = IbanParts.TryParse(value);

            Assert.True(result.IsError);

#if !NO_INTERNALS_VISIBLE_TO
            result.OnError(err => Assert.Equal(Format.Current(Strings.InvalidInput_CheckDigits, value), err));
#endif
        }
Exemple #2
0
        public static Outcome <Iban> TryParse(string value, IbanStyles styles, IbanValidationLevels levels)
        {
            if (value == null)
            {
                return(Outcome <Iban> .FromError(Format.Current(Strings.InvalidIbanValue, value)));
            }

            string input = PreprocessInput(value, styles);

            return(from val in IbanParts.TryParse(input)
                   where IbanValidator.TryValidate(val, levels)
                   select new Iban(val, levels));
        }
Exemple #3
0
        public static void TryParse5(string value, string expectedBban)
        {
            var parts = IbanParts.TryParse(value);

            var countryCode = parts.Select(x => x.CountryCode);

            Assert.True(countryCode.Contains("FR"));

            var checkDigits = parts.Select(x => x.CheckDigits);

            Assert.True(checkDigits.Contains("34"));

            var bban = parts.Select(x => x.Bban);

            Assert.True(bban.Contains(expectedBban));
        }
Exemple #4
0
 public static void Parse3(string value)
 {
     Assert.NotNull(IbanParts.Parse(value));
     Assert.True(IbanParts.TryParse(value).IsSuccess);
 }
Exemple #5
0
 public static void Parse1()
 {
     Assert.Null(IbanParts.Parse(null));
     Assert.False(IbanParts.TryParse(null).IsSuccess);
 }