Beispiel #1
0
 public void ConvertIncorrectUnits_ShouldFail()
 {
     Assert.ThrowsException <ArgumentException>(() => NumericConverter.ConvertLength("12 abc", "foot"));
 }
Beispiel #2
0
 public void ConvertIncorrectPrefix_ShouldFail()
 {
     Assert.ThrowsException <ArgumentException>(() => NumericConverter.ConvertLength("12 superinch", "foot"));
 }
Beispiel #3
0
 public void ConvertEmptyStrings_ShouldFail()
 {
     Assert.ThrowsException <ArgumentException>(() => NumericConverter.ConvertLength("", ""));
 }
Beispiel #4
0
 public void ConvertIncorrectNumber_ShouldFail()
 {
     Assert.ThrowsException <ArgumentException>(() => NumericConverter.ConvertLength("abc inch", "foot"));
 }
Beispiel #5
0
 public void ConvertNulls_ShouldFail()
 {
     Assert.ThrowsException <ArgumentException>(() => NumericConverter.ConvertLength(null, null));
 }
Beispiel #6
0
        public void ConvertFootToFoot_ShouldNotFail()
        {
            var result = NumericConverter.ConvertLength("1 decifoot", "kilofoot");

            Assert.AreEqual(result, "0.0001 kilofoot");
        }
Beispiel #7
0
        public void ConvertDifferentUnitsWithTwoPrefixes_ShouldNotFail()
        {
            var result = NumericConverter.ConvertLength("1.5 decimeter", "kilofoot");

            Assert.AreEqual(result, "0.000492126 kilofoot");
        }
Beispiel #8
0
        public void ConvertSameUnitsWithTwoPrefixes_ShouldNotFail()
        {
            var result = NumericConverter.ConvertLength("2.8 decimeter", "kilometer");

            Assert.AreEqual(result, "0.00028 kilometer");
        }
Beispiel #9
0
        public void ConvertSameUnitsWithOnePrefix_ShouldNotFail()
        {
            var result = NumericConverter.ConvertLength("1 meter", "centimeter");

            Assert.AreEqual(result, "100 centimeter");
        }