public void ParseError(string text) { Assert.Throws <FormatException>(() => LengthUnit.Parse(text)); LengthUnit temp; Assert.AreEqual(false, LengthUnit.TryParse(text, out temp)); }
public static void ParseMetres(string s) { var actual = LengthUnit.Parse(s); var expected = LengthUnit.Metres; Assert.AreEqual(expected, actual); actual = UnitParser <LengthUnit> .Parse(s); Assert.AreEqual(expected, actual); var success = LengthUnit.TryParse(s, out actual); Assert.AreEqual(true, success); Assert.AreEqual(expected, actual); success = UnitParser <LengthUnit> .TryParse(s, out actual); Assert.AreEqual(true, success); Assert.AreEqual(expected, actual); }
public static void ParseSuccess(string text, string expected) { var lengthUnit = LengthUnit.Parse(text); Assert.AreEqual(expected, lengthUnit.ToString()); }
public void ParseSuccess(TestCase testCase) { var lengthUnit = LengthUnit.Parse(testCase.Text); Assert.AreEqual(testCase.Expected, lengthUnit.ToString()); }
public void ParseSuccess(string text) { var lengthUnit = LengthUnit.Parse(text); Assert.AreEqual(text.Trim(), lengthUnit.ToString()); }