ThisToThat/ThisToThatTests/ToUInt64Tests.cs
/// <summary>
/// Makes multiple SByte to nullable UInt64 conversions and asserts that the results are correct.
/// </summary>
Makes multiple SByte to nullable UInt64 conversions and asserts that the results are correct.
Makes multiple SByte to nullable UInt64 conversions and asserts that the results are correct .
[TestMethod, TestCategory("ToUInt64 tests")]
        public void TestSByteToUInt64Nullable()
        {
            SByte source = SByte.MinValue;
            Assert.IsInstanceOfType(source, typeof(SByte));
            UInt64? result = source.ToUInt64Nullable();
            Assert.IsNull(result);
            source = (sbyte)42;
            Assert.IsInstanceOfType(source, typeof(SByte));
            result = source.ToUInt64Nullable();
            Assert.AreEqual(42UL, result);
            Assert.IsInstanceOfType(result, typeof(UInt64));
            source = SByte.MaxValue;
            Assert.IsInstanceOfType(source, typeof(SByte));
            result = source.ToUInt64Nullable();
            Assert.AreEqual(127UL, result);
            Assert.IsInstanceOfType(result, typeof(UInt64));
        }
[ TestMethod , TestCategory ( " " ) ] public void TestSByteToUInt64Nullable ( ) { SByte source = SByte . MinValue ; Assert . IsInstanceOfType ( source , typeof ( SByte ) ) ; UInt64 ? result = source . ToUInt64Nullable ( ) ; Assert . IsNull ( result ) ; source = ( sbyte ) 42 ; Assert . IsInstanceOfType ( source , typeof ( SByte ) ) ; result = source . ToUInt64Nullable ( ) ; Assert . AreEqual ( 42UL , result ) ; Assert . IsInstanceOfType ( result , typeof ( UInt64 ) ) ; source = SByte . MaxValue ; Assert . IsInstanceOfType ( source , typeof ( SByte ) ) ; result = source . ToUInt64Nullable ( ) ; Assert . AreEqual ( 127UL , result ) ; Assert . IsInstanceOfType ( result , typeof ( UInt64 ) ) ; }
Makes multiple SByte to nullable UInt64 conversions and asserts that the results are correct.
Makes multiple SByte 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 (-128) 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