ThisToThat/ThisToThatTests/ToUInt64Tests.cs
/// <summary>
/// Makes multiple Int32 to nullable UInt64 conversions and asserts that the results are correct.
/// </summary>
Makes multiple Int32 to nullable UInt64 conversions and asserts that the results are correct.
Makes multiple Int32 to nullable UInt64 conversions and asserts that the results are correct .
[TestMethod, TestCategory("ToUInt64 tests")]
        public void TestInt32ToUInt64Nullable()
        {
            Int32 source = Int32.MinValue;
            Assert.IsInstanceOfType(source, typeof(Int32));
            UInt64? result = source.ToUInt64Nullable();
            Assert.IsNull(result);
            source = 42;
            Assert.IsInstanceOfType(source, typeof(Int32));
            result = source.ToUInt64Nullable();
            Assert.AreEqual(42UL, result);
            Assert.IsInstanceOfType(result, typeof(UInt64));
            source = Int32.MaxValue;
            Assert.IsInstanceOfType(source, typeof(Int32));
            result = source.ToUInt64Nullable();
            Assert.AreEqual(2147483647UL, result);
            Assert.IsInstanceOfType(result, typeof(UInt64));
        }
[ TestMethod , TestCategory ( " " ) ] public void TestInt32ToUInt64Nullable ( ) { Int32 source = Int32 . MinValue ; Assert . IsInstanceOfType ( source , typeof ( Int32 ) ) ; UInt64 ? result = source . ToUInt64Nullable ( ) ; Assert . IsNull ( result ) ; source = 42 ; Assert . IsInstanceOfType ( source , typeof ( Int32 ) ) ; result = source . ToUInt64Nullable ( ) ; Assert . AreEqual ( 42UL , result ) ; Assert . IsInstanceOfType ( result , typeof ( UInt64 ) ) ; source = Int32 . MaxValue ; Assert . IsInstanceOfType ( source , typeof ( Int32 ) ) ; result = source . ToUInt64Nullable ( ) ; Assert . AreEqual ( 2147483647UL , result ) ; Assert . IsInstanceOfType ( result , typeof ( UInt64 ) ) ; }
Makes multiple Int32 to nullable UInt64 conversions and asserts that the results are correct.
Makes multiple Int32 to nullable UInt64 conversions and asserts that the results are correct .
// Test conversion of source type minimum value // Here we would expect this conversion to fail (and return null),  // since the source type's minimum value (-2147483648) is less than the target type's minimum value (0). // Test conversion of source type value 42 to target type // Test conversion of source type maximum value