Exemplo n.º 1
0
            public void Should_Append_Options(SkipDirective directive, string expected)
            {
                //Given --> When
                var actual = directive.ToCommandLineArgument();

                //Then
                Assert.Equal(expected, directive.ToCommandLineArgument());
            }
Exemplo n.º 2
0
            public void Should_Throw_If_Context_Is_Null()
            {
                // Given
                var rule = new SkipDirective();

                // When
                var result = Record.Exception(() => rule.AppendCommandLineArgument(null));

                // Then
                Assert.IsArgumentNullException(result, "sb");
            }
        public void prints_directive()
        {
            var printer = new SchemaPrinter(null, new SchemaPrinterOptions {
                IncludeDescriptions = true
            });
            var skip = new SkipDirective();
            var arg  = skip.Arguments.First();

            arg.ResolvedType = arg.Type.BuildNamedType();

            var          result   = printer.PrintDirective(skip);
            const string expected = @"# Directs the executor to skip this field or fragment when the 'if' argument is true.
directive @skip(
  if: Boolean!
) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT";

            AssertEqual(result, "directive", expected, excludeScalars: true);
        }