Example #1
0
        public void Serialize_Wrong_Type_Throws()
        {
            // arrange
            var type  = new LongType();
            var input = "abc";

            // act
            // assert
            Assert.Throws <SerializationException>(
                () => type.Serialize(input));
        }
Example #2
0
        public void Serialize_Null()
        {
            // arrange
            var type = new LongType();

            // act
            var serializedValue = type.Serialize(null);

            // assert
            Assert.Null(serializedValue);
        }
Example #3
0
        public void Serialize_MaxValue_Violation()
        {
            // arrange
            var  type  = new LongType(0, 100);
            long value = 200;

            // act
            // assert
            Assert.Throws <SerializationException>(
                () => type.Serialize(value));
        }
Example #4
0
        public void Serialize_Type()
        {
            // arrange
            var  type  = new LongType();
            long value = 123;

            // act
            var serializedValue = type.Serialize(value);

            // assert
            Assert.IsType <long>(serializedValue);
            Assert.Equal(value, serializedValue);
        }