コード例 #1
0
        public void ToInt16()
        {
            var converter = ConverterFactory.Create <int, short>();

            // Base
            Assert.Equal(0, converter(0));
            Assert.Equal(1, converter(1));
            Assert.Equal(-1, converter(-1));
            // Min/Max
            Assert.Equal(ManualConverter.Int32ToInt16(0), converter(0));
            Assert.Equal(ManualConverter.Int32ToInt16(1), converter(1));
            Assert.Equal(ManualConverter.Int32ToInt16(-1), converter(-1));
            Assert.Equal(ManualConverter.Int32ToInt16(Int32.MinValue), converter(Int32.MinValue));
            Assert.Equal(ManualConverter.Int32ToInt16(Int32.MaxValue), converter(Int32.MaxValue));
        }