ThisToThat/ThisToThatTests/ToSByteTests.cs
/// <summary>
/// Makes multiple UInt64 to nullable SByte conversions and asserts that the results are correct.
/// </summary>
Makes multiple UInt64 to nullable SByte conversions and asserts that the results are correct.
Makes multiple UInt64 to nullable SByte conversions and asserts that the results are correct .
[TestMethod, TestCategory("ToSByte tests")]
        public void TestUInt64ToSByteNullable()
        {
            UInt64 source = UInt64.MinValue;
            Assert.IsInstanceOfType(source, typeof(UInt64));
            SByte? result = source.ToSByteNullable();
            Assert.AreEqual((sbyte)0, result);
            Assert.IsInstanceOfType(result, typeof(SByte));
            source = 42UL;
            Assert.IsInstanceOfType(source, typeof(UInt64));
            result = source.ToSByteNullable();
            Assert.AreEqual((sbyte)42, result);
            Assert.IsInstanceOfType(result, typeof(SByte));
            source = UInt64.MaxValue;
            Assert.IsInstanceOfType(source, typeof(UInt64));
            result = source.ToSByteNullable();
            Assert.IsNull(result);
        }
[ TestMethod , TestCategory ( " " ) ] public void TestUInt64ToSByteNullable ( ) { UInt64 source = UInt64 . MinValue ; Assert . IsInstanceOfType ( source , typeof ( UInt64 ) ) ; SByte ? result = source . ToSByteNullable ( ) ; Assert . AreEqual ( ( sbyte ) 0 , result ) ; Assert . IsInstanceOfType ( result , typeof ( SByte ) ) ; source = 42UL ; Assert . IsInstanceOfType ( source , typeof ( UInt64 ) ) ; result = source . ToSByteNullable ( ) ; Assert . AreEqual ( ( sbyte ) 42 , result ) ; Assert . IsInstanceOfType ( result , typeof ( SByte ) ) ; source = UInt64 . MaxValue ; Assert . IsInstanceOfType ( source , typeof ( UInt64 ) ) ; result = source . ToSByteNullable ( ) ; Assert . IsNull ( result ) ; }
Makes multiple UInt64 to nullable SByte conversions and asserts that the results are correct.
Makes multiple UInt64 to nullable SByte conversions and asserts that the results are correct .
// Test conversion of source type minimum value // Test conversion of source type value 42 to target type // Test conversion of source type maximum value // Here we would expect this conversion to fail (and return null),  // since the source type's maximum value (18446744073709551615) is greater than the target type's maximum value (127).