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

            Assert.That(actual, Is.EqualTo(expected));
        }
예제 #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;
        }
예제 #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);
        }