コード例 #1
0
        [InlineData("hello", "hello")]     // parsing "hello" should return "hello"
        public void ParseValue(string externalValue, string internalValue)
        {
            var c = new CustomScalar();

            // try parsing value
            c.ParseValue(externalValue).ShouldBe(internalValue);
        }
コード例 #2
0
        [InlineData("hello", "hello")]     // serializing "hello" should return "hello"
        public void Serialize(string internalValue, string externalValue)
        {
            var c = new CustomScalar();

            // try serializing
            c.Serialize(internalValue).ShouldBe(externalValue);
        }
コード例 #3
0
        [InlineData("hello", "hello")]     // parsing "hello" should return "hello"
        public void ParseLiteral(string externalValue, string internalValue)
        {
            var c = new CustomScalar();

            // try parsing literal AST
            c.ParseLiteral(externalValue == null ? (IValue) new NullValue() : new StringValue(externalValue)).ShouldBe(internalValue);
        }
コード例 #4
0
        [InlineData("hello", "hello")]     // serializing "hello" should return "hello"
        public void ToAST(string internalValue, string externalValue)
        {
            var c = new CustomScalar();
            // try converting internal value to AST
            var ast = c.ToAST(internalValue);

            ast.ShouldNotBeNull();
            ast.Value.ShouldBe(externalValue);
        }