Esempio n. 1
0
        public void Serialize_String_Exception()
        {
            // arrange
            BooleanType booleanType = new BooleanType();

            // act
            Action a = () => booleanType.Serialize("foo");

            // assert
            Assert.Throws <ArgumentException>(a);
        }
Esempio n. 2
0
        public void Deserialize_Null_Null()
        {
            // arrange
            BooleanType booleanType = new BooleanType();

            // act
            object result = booleanType.Serialize(null);

            // assert
            Assert.Null(result);
        }
Esempio n. 3
0
        public void EnsureBooleanTypeKindIsCorret()
        {
            // arrange
            BooleanType type = new BooleanType();

            // act
            TypeKind kind = type.Kind;

            // assert
            Assert.Equal(TypeKind.Scalar, type.Kind);
        }
Esempio n. 4
0
        public void Deserialize_String_Exception()
        {
            // arrange
            var booleanType = new BooleanType();

            // act
            Action a = () => booleanType.Serialize("foo");

            // assert
            Assert.Throws <SerializationException>(a);
        }
Esempio n. 5
0
        public void Serialize_True_True()
        {
            // arrange
            BooleanType booleanType = new BooleanType();

            // act
            object result = booleanType.Serialize(true);

            // assert
            Assert.IsType <bool>(result);
            Assert.True((bool)result);
        }
Esempio n. 6
0
        public void ParseLiteral()
        {
            // arrange
            BooleanValueNode literal = new BooleanValueNode(null, true);

            // act
            BooleanType booleanType = new BooleanType();
            object      result      = booleanType.ParseLiteral(literal);

            // assert
            Assert.IsType <bool>(result);
            Assert.True((bool)result);
        }
Esempio n. 7
0
        public void IsInstanceOfType()
        {
            // arrange
            BooleanValueNode boolLiteral   = new BooleanValueNode(null, true);
            StringValueNode  stringLiteral = new StringValueNode(null, "12345", false);
            NullValueNode    nullLiteral   = NullValueNode.Default;

            // act
            BooleanType booleanType               = new BooleanType();
            bool        isIntLiteralInstanceOf    = booleanType.IsInstanceOfType(boolLiteral);
            bool        isStringLiteralInstanceOf = booleanType.IsInstanceOfType(stringLiteral);
            bool        isNullLiteralInstanceOf   = booleanType.IsInstanceOfType(nullLiteral);

            // assert
            Assert.True(isIntLiteralInstanceOf);
            Assert.False(isStringLiteralInstanceOf);
            Assert.True(isNullLiteralInstanceOf);
        }