コード例 #1
0
    public void HuInvFallback()
    {
        var converter = new DecimalConverterAuto(new CultureInfo("hu-HU"));
        var result    = converter.Convert("1.234");

        Assert.AreEqual(1.234m, result);
    }
コード例 #2
0
    public void HuEnStringWithThousandsFallbackToInvariant()
    {
        var converter = new DecimalConverterAuto(new CultureInfo("hu-HU"));
        var result    = converter.Convert("1,234,456.2");

        Assert.AreEqual(1234456.2m, result);
    }
コード例 #3
0
    public void InvInv()
    {
        var converter = new DecimalConverterAuto(CultureInfo.InvariantCulture);
        var result    = converter.Convert("1.234");

        Assert.AreEqual(1.234m, result);
    }
コード例 #4
0
    public void HuHuThousandsNegBrokenWhiteSpace()
    {
        var converter = new DecimalConverterAuto(new CultureInfo("hu-HU"));
        var result    = converter.Convert("- 1 234 456,2");

        Assert.AreEqual(null, result);
    }
コード例 #5
0
    public void UsInvBroken()
    {
        var converter = new DecimalConverterAuto(new CultureInfo("en-US"));
        var result    = converter.Convert("1.234.456,2");

        Assert.AreEqual(null, result);
    }
コード例 #6
0
    public void HuHuPosBrokenWhiteSpace()
    {
        var converter = new DecimalConverterAuto(new CultureInfo("hu-HU"));
        var result    = converter.Convert("+ 1,234");

        Assert.AreEqual(null, result);
    }
コード例 #7
0
    public void UsInvFallback()
    {
        var converter = new DecimalConverterAuto(new CultureInfo("en-US"));
        var result    = converter.Convert("1234456.2");

        Assert.AreEqual(1234456.2m, result);
    }
コード例 #8
0
    public void UsUsThousands()
    {
        var converter = new DecimalConverterAuto(new CultureInfo("en-US"));
        var result    = converter.Convert("1,234,456.2");

        Assert.AreEqual(1234456.2m, result);
    }
コード例 #9
0
    public void InvHuStringWithThousandsBroken()
    {
        var converter = new DecimalConverterAuto(CultureInfo.InvariantCulture);
        var result    = converter.Convert("1 234 456,2");

        Assert.AreEqual(null, result);
    }
コード例 #10
0
    public void InvHuStringRecognizedThousandSeparator()
    {
        var converter = new DecimalConverterAuto(new CultureInfo("hu-HU"));
        var result    = converter.Convert("123,2");

        Assert.AreEqual(123.2m, result);
    }
コード例 #11
0
    public void InvHuStringMisrecognizedThousandSeparator()
    {
        var converter = new DecimalConverterAuto(CultureInfo.InvariantCulture);
        var result    = converter.Convert("123,2");

        Assert.AreEqual(1232.0m, result);
    }