ThisToThat/ThisToThatTests/ToInt32Tests.cs
/// <summary>
/// Makes multiple String to Int32 or default conversions and asserts that the results are correct.
/// </summary>
Makes multiple String to Int32 or default conversions and asserts that the results are correct.
Makes multiple String to Int32 or default conversions and asserts that the results are correct .
[TestMethod, TestCategory("ToInt32 tests")]
        public void TestStringToInt32OrDefault()
        {
            Int32 resultMin = "-2147483648".ToInt32OrDefault();
            Assert.AreEqual(-2147483648, resultMin);
            Int32 result42 = "42".ToInt32OrDefault();
            Assert.AreEqual(42, result42);
            Int32 resultMax = "2147483647".ToInt32OrDefault();
            Assert.AreEqual(2147483647, resultMax);
            Int32 resultFoo = "foo".ToInt32OrDefault(86);
            Assert.AreEqual(86, resultFoo);
        }
[ TestMethod , TestCategory ( " " ) ] public void TestStringToInt32OrDefault ( ) { Int32 resultMin = " " . ToInt32OrDefault ( ) ; Assert . AreEqual ( - 2147483648 , resultMin ) ; Int32 result42 = " " . ToInt32OrDefault ( ) ; Assert . AreEqual ( 42 , result42 ) ; Int32 resultMax = " " . ToInt32OrDefault ( ) ; Assert . AreEqual ( 2147483647 , resultMax ) ; Int32 resultFoo = " " . ToInt32OrDefault ( 86 ) ; Assert . AreEqual ( 86 , resultFoo ) ; }
Makes multiple String to Int32 or default conversions and asserts that the results are correct.
Makes multiple String to Int32 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"