public void Given_OpenApiResponseWithBodyAttribute_With_Deprecated_When_ToOpenApiMediaType_Invoked_Then_It_Should_Return_Result(bool deprecated) { var statusCode = HttpStatusCode.OK; var contentType = "application/json"; var bodyType = typeof(object); var attribute = new OpenApiResponseWithBodyAttribute(statusCode, contentType, bodyType) { Deprecated = deprecated, }; var namingStrategy = new CamelCaseNamingStrategy(); var result = OpenApiPayloadAttributeExtensions.ToOpenApiMediaType(attribute, namingStrategy); result.Schema.Deprecated.Should().Be(deprecated); }
public void Given_OpenApiRequestBodyAttribute_With_Deprecated_When_ToOpenApiMediaType_Invoked_Then_It_Should_Return_Result(bool deprecated) { var contentType = "application/json"; var bodyType = typeof(object); var attribute = new OpenApiRequestBodyAttribute(contentType, bodyType) { Required = true, Description = "Dummy request model", Deprecated = deprecated, }; var namingStrategy = new CamelCaseNamingStrategy(); var result = OpenApiPayloadAttributeExtensions.ToOpenApiMediaType(attribute, namingStrategy); result.Schema.Deprecated.Should().Be(deprecated); }
public void Given_Null_When_ToOpenApiMediaType_Invoked_Then_It_Should_Throw_Exception() { Action action = () => OpenApiPayloadAttributeExtensions.ToOpenApiMediaType((OpenApiPayloadAttribute)null); action.Should().Throw <ArgumentNullException>(); }