ThisToThat/ThisToThatTests/ToSingleTests.cs
/// <summary>
/// Makes multiple String to Single or default conversions and asserts that the results are correct.
/// </summary>
Makes multiple String to Single or default conversions and asserts that the results are correct.
Makes multiple String to Single or default conversions and asserts that the results are correct .
[TestMethod, TestCategory("ToSingle tests")]
        public void TestStringToSingleOrDefault()
        {
            Single resultMin = "-3.40282347E+38".ToSingleOrDefault();
            Assert.AreEqual(-3.40282347E+38f, resultMin);
            Single result42 = "42".ToSingleOrDefault();
            Assert.AreEqual(42f, result42);
            Single resultMax = "3.40282347E+38".ToSingleOrDefault();
            Assert.AreEqual(3.40282347E+38f, resultMax);
            Single resultFoo = "foo".ToSingleOrDefault(86f);
            Assert.AreEqual(86f, resultFoo);
        }
[ TestMethod , TestCategory ( " " ) ] public void TestStringToSingleOrDefault ( ) { Single resultMin = " " . ToSingleOrDefault ( ) ; Assert . AreEqual ( - 3.40282347E+38f , resultMin ) ; Single result42 = " " . ToSingleOrDefault ( ) ; Assert . AreEqual ( 42f , result42 ) ; Single resultMax = " " . ToSingleOrDefault ( ) ; Assert . AreEqual ( 3.40282347E+38f , resultMax ) ; Single resultFoo = " " . ToSingleOrDefault ( 86f ) ; Assert . AreEqual ( 86f , resultFoo ) ; }
Makes multiple String to Single or default conversions and asserts that the results are correct.
Makes multiple String to Single 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"