예제 #1
0
        private static LongType ConvertFrom(object o)
        {
            var type = new LongType();

            type.SetValue(o);
            return(type);
        }
예제 #2
0
        private static T ConvertTo <T>(LongType type)
        {
            if (type == null)
            {
                return(default(T));
            }

            return(type.GetValue <T>());
        }
예제 #3
0
        public void Implicit_Int64_Cast()
        {
            // arrange
            long expected = 100;

            // act
            LongType actual = expected;

            // assert
            Assert.Equal(expected, (long)actual);
        }
예제 #4
0
        public void Implicit_SByte_Cast()
        {
            // arrange
            sbyte expected = 100;

            // act
            LongType actual = expected;

            // assert
            Assert.Equal(expected, (sbyte)actual);
        }
예제 #5
0
        public void Implicit_Int32_Cast()
        {
            // arrange
            int expected = 100;

            // act
            LongType actual = expected;

            // assert
            Assert.Equal(expected, (int)actual);
        }
예제 #6
0
        public void Implicit_Int16_Cast()
        {
            // arrange
            short expected = 100;

            // act
            LongType actual = expected;

            // assert
            Assert.Equal(expected, (short)actual);
        }
예제 #7
0
        public void Operator_NotEqualTo()
        {
            // arrange
            long     value = 100L;
            LongType type  = value;

            // act
            bool actual = type != value;

            // assert
            Assert.False(actual);
        }
예제 #8
0
        public void Operator_EqualTo()
        {
            // arrange
            long     value = 100L;
            LongType type  = value;

            // act
            bool actual = type == value;

            // assert
            Assert.IsTrue(actual);
        }
예제 #9
0
        public void Implicit_ByteArray_Cast()
        {
            // arrange
            byte[] expected = new byte[] { 0, 0, 0, 0, 0, 0, 64, 128 };

            // act
            LongType actualType = expected;

            byte[] actual = actualType;

            // assert
            Assert.True(expected.SequenceEqual(actual));
        }