Exemple #1
0
        public void ConvertToString()
        {
            //Given
            var variables = new Mock <JObject>();

            variables.Setup(x => x.ToString()).Returns("Test Variables");

            var query = new GraphQLQuery
            {
                OperationName = "Test Operation",
                NamedQuery    = "Test Named Query",
                Query         = "Test Query",
                Variables     = variables.Object
            };

            //When
            var str = query.ToString();

            //Then
            Assert.Equal(
                @"
OperationName = Test Operation
NamedQuery = Test Named Query
Query = Test Query
Variables = Test Variables
", str);
        }
Exemple #2
0
        public void ConvertToEmptyString()
        {
            //Given
            var query = new GraphQLQuery
            {
            };

            //When
            var str = query.ToString();

            //Then
            Assert.Equal(Environment.NewLine, str);
        }
Exemple #3
0
        public void ReturnFormattedText()
        {
            // Given
            var query = new GraphQLQuery
            {
                OperationName = "OperationName",
                NamedQuery    = "NamedQuery",
                Query         = "Query",
                Variables     = "Variables"
            };

            // When
            var text = query.ToString();

            // Then
            Assert.NotEmpty(text);
            Assert.Equal("\r\nOperationName = OperationName\r\nNamedQuery = NamedQuery\r\nQuery = Query\r\nVariables = Variables\r\n", text);
        }