Beispiel #1
0
 /// <summary>
 ///     Assert that the object is inherit of <see cref="Microsoft.AspNetCore.Mvc.Routing.HttpMethodAttribute"/> with the specified template.
 /// </summary>
 public static AndConstraint <StringAssertions> WithHttpTemplate <T>(this ObjectAssertions assert, string template) where T : HttpMethodAttribute
 {
     return(assert.IsType <T>().Template.Should().Be(template));
 }
Beispiel #2
0
 /// <summary>
 ///     Assert that the object is inherit of <see cref="Microsoft.AspNetCore.Mvc.Routing.HttpMethodAttribute"/> with the specified httpMethod.
 /// </summary>
 public static AndConstraint <StringAssertions> BeOfHttpAttribute <T>(this ObjectAssertions assert, string httpMethod) where T : HttpMethodAttribute
 {
     return(assert.IsType <T>().HttpMethods.Single().Should().Be(httpMethod));
 }
Beispiel #3
0
 /// <summary>
 ///     Assert that the object is an <see cref="Microsoft.AspNetCore.Mvc.RouteAttribute"/> with the specified template.
 /// </summary>
 public static AndConstraint <StringAssertions> WithRouteTemplate(this ObjectAssertions assert, string template)
 {
     return(assert.IsType <RouteAttribute>().Template.Should().Be(template));
 }
Beispiel #4
0
 /// <summary>
 ///     Assert that the object is an <see cref="Microsoft.AspNetCore.Mvc.ProducesAttribute"/> with the specified mediaTypeName.
 /// </summary>
 public static AndConstraint <StringAssertions> BeOfProducesAttribute(this ObjectAssertions assert, string mediaTypeName)
 {
     return(assert.IsType <ProducesAttribute>().ContentTypes.Single().Should().Be(mediaTypeName));
 }
Beispiel #5
0
 /// <summary>
 ///     Assert that the object is an <see cref="Microsoft.AspNetCore.Mvc.ProducesResponseTypeAttribute"/> with the specified status code.
 /// </summary>
 public static AndConstraint <NumericAssertions <int> > BeOfProducesResponseTypeAttribute(this ObjectAssertions assert, int statusCode)
 {
     return(assert.IsType <ProducesResponseTypeAttribute>().StatusCode.Should().Be(statusCode));
 }