コード例 #1
0
        public void Execute_InvalidNumeric_Null(string text, string culture)
        {
            var cultureInfo = new CultureInfo(culture);
            var converter   = new TextToNumericConverter(cultureInfo, null);
            var newValue    = converter.Execute(text);

            Assert.That(newValue, Is.Null);
        }
コード例 #2
0
        public void Execute_InvalidNumeric_Decimal(string text, string culture)
        {
            var cultureInfo = new CultureInfo(culture);
            var converter   = new TextToNumericConverter(cultureInfo, -1m);
            var newValue    = converter.Execute(text);

            Assert.That(newValue, Is.TypeOf <Decimal>());
            Assert.That(newValue, Is.EqualTo(-1));
        }
コード例 #3
0
        public void Execute_ValidNumeric_Decimal(string culture)
        {
            var cultureInfo = new CultureInfo(culture);
            var text        = (100.456).ToString(cultureInfo.NumberFormat);

            Console.WriteLine(text);

            var converter = new TextToNumericConverter(cultureInfo, -1m);
            var newValue  = converter.Execute(text);

            Assert.That(newValue, Is.TypeOf <Decimal>());
            Assert.That(newValue, Is.EqualTo(new Decimal(100.456)));
        }