Пример #1
0
        public static ExceptionAssertions <ArgumentException> ThrowInvalidGraphQLNameException(this ActionAssertions actionShould, string argumentName, string because)
        {
            using (new AssertionScope())
            {
                var exceptionAssertions = actionShould.ThrowExactly <ArgumentException>(because)
                                          .WithMessage("Provided name does not comply with GraphQL's name specification.*");

                exceptionAssertions.And.ParamName.Should().Be(argumentName, "because this is the argument that violates GraphQL's name specification");
                exceptionAssertions.And.HelpLink.Should().Be("https://spec.graphql.org/June2018/#Name",
                                                             "because this is the GraphQL Name specification");

                return(exceptionAssertions);
            }
        }
Пример #2
0
 /// <summary>
 /// Asserts that a validation for a null argument happened.
 /// </summary>
 ///
 /// <param name="actionAssertions">A reference to the method or property.</param>
 /// <param name="argumentName">The name of the argument to be verified.</param>
 public static ExceptionAssertions <ArgumentNullException> ThrowArgumentNullException(this ActionAssertions actionAssertions, string argumentName)
 => actionAssertions
 .ThrowExactly <ArgumentNullException>()
 .WithMessage($"*{argumentName}*");