Ejemplo n.º 1
0
        public void Serialize_Wrong_Type_Throws()
        {
            // arrange
            var type  = new ByteType();
            var input = "abc";

            // act
            // assert
            Assert.Throws <SerializationException>(
                () => type.Serialize(input));
        }
Ejemplo n.º 2
0
        public void Serialize_Null()
        {
            // arrange
            var type = new ByteType();

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

            // assert
            Assert.Null(serializedValue);
        }
Ejemplo n.º 3
0
        public void Serialize_MaxValue_Violation()
        {
            // arrange
            var  type  = new ByteType(0, 100);
            byte value = 200;

            // act
            // assert
            Assert.Throws <SerializationException>(
                () => type.Serialize(value));
        }
Ejemplo n.º 4
0
        public void Serialize_Type()
        {
            // arrange
            var  type  = new ByteType();
            byte value = 123;

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

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