public void GoodBooleanArgDefault() { // arrange Schema schema = ValidationUtils.CreateSchema(); DocumentNode query = Parser.Default.Parse(@" fragment goodBooleanArgDefault on Arguments { booleanArgField } "); // act var validator = new RequiredArgumentRule(); QueryValidationResult result = validator.Validate(schema, query); // assert Assert.False(result.HasErrors); }
public void MissingRequiredDirectiveArg() { // arrange Schema schema = ValidationUtils.CreateSchema(); DocumentNode query = Parser.Default.Parse(@" fragment missingRequiredArg on Arguments { nonNullBooleanArgField(nonNullBooleanArg: true) @skip() } "); // act var validator = new RequiredArgumentRule(); QueryValidationResult result = validator.Validate(schema, query); // assert Assert.True(result.HasErrors); Assert.Collection(result.Errors, t => Assert.Equal( $"The argument `if` is required " + "and does not allow null values.", t.Message)); }