ThisToThat/ThisToThatTests/ToDoubleTests.cs
/// <summary>
/// Makes multiple String to Double or default conversions and asserts that the results are correct.
/// </summary>
Makes multiple String to Double or default conversions and asserts that the results are correct.
Makes multiple String to Double or default conversions and asserts that the results are correct .
[TestMethod, TestCategory("ToDouble tests")]
        public void TestStringToDoubleOrDefault()
        {
            Double resultMin = "-1.7976931348623157E+308".ToDoubleOrDefault();
            Assert.AreEqual(-1.7976931348623157E+308d, resultMin);
            Double result42 = "42".ToDoubleOrDefault();
            Assert.AreEqual(42d, result42);
            Double resultMax = "1.7976931348623157E+308".ToDoubleOrDefault();
            Assert.AreEqual(1.7976931348623157E+308d, resultMax);
            Double resultFoo = "foo".ToDoubleOrDefault(86d);
            Assert.AreEqual(86d, resultFoo);
        }
[ TestMethod , TestCategory ( " " ) ] public void TestStringToDoubleOrDefault ( ) { Double resultMin = " " . ToDoubleOrDefault ( ) ; Assert . AreEqual ( - 1.7976931348623157E+308d , resultMin ) ; Double result42 = " " . ToDoubleOrDefault ( ) ; Assert . AreEqual ( 42d , result42 ) ; Double resultMax = " " . ToDoubleOrDefault ( ) ; Assert . AreEqual ( 1.7976931348623157E+308d , resultMax ) ; Double resultFoo = " " . ToDoubleOrDefault ( 86d ) ; Assert . AreEqual ( 86d , resultFoo ) ; }
Makes multiple String to Double or default conversions and asserts that the results are correct.
Makes multiple String to Double or default conversions and asserts that the results are correct .
// Test conversion of target type minimum value // Test conversion of fixed value (42) // Test conversion of target type maximum value // Test conversion of "foo"