Ejemplo n.º 1
0
        public void ParseValue_Wrong_Value_Throws()
        {
            // arrange
            var type  = new ByteType();
            var value = "123";

            // act
            // assert
            Assert.Throws <SerializationException>(
                () => type.ParseValue(value));
        }
Ejemplo n.º 2
0
        public void ParseValue_Nullable()
        {
            // arrange
            var  type  = new ByteType();
            byte?input = 123;

            // act
            IntValueNode output = (IntValueNode)type.ParseValue(input);

            // assert
            Assert.Equal(123, output.ToDouble());
        }
Ejemplo n.º 3
0
        public void ParseValue_Null()
        {
            // arrange
            var    type  = new ByteType();
            object input = null;

            // act
            object output = type.ParseValue(input);

            // assert
            Assert.IsType <NullValueNode>(output);
        }
Ejemplo n.º 4
0
        public void ParseValue_MinValue_Violation()
        {
            // arrange
            var  type  = new ByteType(1, 100);
            byte input = 0;

            // act
            Action action = () => type.ParseValue(input);

            // assert
            Assert.Throws <SerializationException>(action);
        }
Ejemplo n.º 5
0
        public void ParseValue_MinValue()
        {
            // arrange
            var  type  = new ByteType(1, 100);
            byte input = 1;

            // act
            var literal = (IntValueNode)type.ParseValue(input);

            // assert
            Assert.Equal(1, literal.ToByte());
        }