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

            Assert.That(actual, Is.EqualTo(expected));
        }
Example #2
0
        public static IPower Parse(double value, string type)
        {
            IPower result;

            switch (type.ToLower())
            {
            case "w":
            case "watt":
            case "watts":
                result = new WattsPower(value);
                break;

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

            return(result);
        }
Example #3
0
        public static IPower Parse(double value, string type)
        {
            IPower result;

            switch (type.ToLower())
            {
                case "w":
                case "watt":
                case "watts":
                    result = new WattsPower(value);
                    break;

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

            return result;
        }