示例#1
0
        public void TestComplexFractionValue3()
        {
            var divide   = new ParseFraction();
            var expected = 10.3333m;
            var actual   = divide.Parse("10 1/3");

            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void TestDecimalParsing1()
        {
            var parse    = new ParseFraction();
            var expected = 10.125m;
            var actual   = parse.Parse("10.125");

            Assert.AreEqual(expected, actual);
        }
示例#3
0
        public void TestComplexFractionValue()
        {
            var divide   = new ParseFraction();
            var expected = 1.50m;
            var actual   = divide.Parse("1 1/2");

            Assert.AreEqual(expected, actual);
        }
示例#4
0
        public void TestComplexFractionValue2()
        {
            var divide   = new ParseFraction();
            var expected = 2.75m;
            var actual   = divide.Parse("2 3/4");

            Assert.AreEqual(expected, actual);
        }
示例#5
0
        public void TestSimpleFractionValue4()
        {
            var divide   = new ParseFraction();
            var expected = 4.75;
            var actual   = divide.Parse("19/4");

            Assert.AreEqual(expected, actual);
        }
示例#6
0
        public void TestSimpleFractionValue3()
        {
            var divide   = new ParseFraction();
            var expected = .0575m; //this was .057... so i guess it did round up?
            var actual   = divide.Parse("45/783");

            Assert.AreEqual(expected, actual);
        }
示例#7
0
        public void TestSimpleFractionValue2()
        {
            var divide   = new ParseFraction();
            var expected = .125m; //i guess the question is whether or not it rounds up or down... i guess it rounds down (this is .125)
            var actual   = divide.Parse("1/8");

            Assert.AreEqual(expected, actual);
        }
示例#8
0
        public void TestIncorrectCharParsing2()
        {
            var parse    = new ParseFraction();
            var expected = 0m;
            var actual   = parse.Parse("5-6");

            Assert.AreEqual(expected, actual);
        }
示例#9
0
        public void TestSimpleFractionValue()
        {
            var divide   = new ParseFraction();
            var expected = .6667m;
            var actual   = divide.Parse("2/3");

            Assert.AreEqual(expected, actual);
        }