Esempio n. 1
0
        public void ToStringShouldWork(double value, string expected)
        {
            var original = new PercentageRatio(value);
            var actual = original.ToString();

            Assert.That(actual, Is.EqualTo(expected));
        }
Esempio n. 2
0
        public static IRatio Parse(double value, string type)
        {
            IRatio result;

            switch (type.ToLower())
            {
                case "%":
                case "percent":
                    result = new PercentageRatio(value);
                    break;

                default:
                    throw new Exception("Could not determine type " + type);
            }

            return result;
        }
Esempio n. 3
0
        public static IRatio Parse(double value, string type)
        {
            IRatio result;

            switch (type.ToLower())
            {
            case "%":
            case "percent":
                result = new PercentageRatio(value);
                break;

            default:
                throw new Exception("Could not determine type " + type);
            }

            return(result);
        }