コード例 #1
0
        private void AssertResult(string query, string expected, Data data, IReadOnlyList <ExecutionError> errors)
        {
            ExecutionResult result =
                AssertQueryWithErrors(
                    query,
                    expected,
                    root: data,
                    expectedErrorCount: errors.Count);

            ExecutionErrors actualErrors = result.Errors;

            if (errors.Count == 0)
            {
                actualErrors.ShouldBeNull();
            }
            else
            {
                actualErrors.Count.ShouldBe(errors.Count);

                for (var i = 0; i < errors.Count; i++)
                {
                    ExecutionError actualError   = actualErrors[i];
                    ExecutionError expectedError = errors[i];

                    actualError.Message.ShouldBe(expectedError.Message);
                    actualError.Path.ShouldBe(expectedError.Path);
                }
            }
        }
コード例 #2
0
        private void AssertResult(string query, string expected, Data data, IReadOnlyList <ExecutionError> errors, bool executed = true)
        {
            ExecutionResult result =
                AssertQueryWithErrors(
                    query,
                    expected,
                    root: data,
                    expectedErrorCount: errors.Count,
                    executed: executed);

            ExecutionErrors actualErrors = result.Errors;

            if (errors.Count == 0)
            {
                actualErrors.ShouldBeNull();
            }
            else
            {
                actualErrors.Count.ShouldBe(errors.Count);

                for (var i = 0; i < errors.Count; i++)
                {
                    ExecutionError actualError   = actualErrors[i];
                    ExecutionError expectedError = errors[i];

                    actualError.Message.ShouldBe(expectedError.Message);
                    actualError.Path.ShouldBe(expectedError.Path);
                    if (expectedError.InnerException == null)
                    {
                        actualError.InnerException.ShouldBeNull();
                    }
                    else
                    {
                        actualError.InnerException.ShouldNotBeNull();
                        actualError.InnerException.ShouldBeOfType(expectedError.InnerException.GetType());
                        actualError.InnerException.Message.ShouldBe(expectedError.InnerException.Message);
                    }
                }
            }
        }