public void TestInitialize() { _operation = new OpenApiOperation { Parameters = new List <OpenApiParameter>(_inputApiParameters.Select( param => new OpenApiParameter { Name = param.Name, Required = true, })) }; var method = FunctionMethodTestSource.GetMethodInfo(); _schemaRegistry = A.Fake <ISchemaGenerator>(); _schemaRepository = new SchemaRepository(); var apiDescription = new ApiDescription(); foreach (var inputApiParameter in _inputApiParameters) { var parameterDescription = new ApiParameterDescription { Name = inputApiParameter.Name, RouteInfo = inputApiParameter.HasRouteInfo ? new ApiParameterRouteInfo { IsOptional = inputApiParameter.IsOptional } : null }; apiDescription.ParameterDescriptions.Add(parameterDescription); } _context = new OperationFilterContext(apiDescription, _schemaRegistry, _schemaRepository, method); _sut = new HttpFunctionOptionalParameterFilter(); }
public void TestInitialize() { _operation = new OpenApiOperation { Parameters = new List <OpenApiParameter>(_inputApiParameters.Select( param => new OpenApiParameter { Name = param.Name, In = param.Location })) }; var method = FunctionMethodTestSource.GetMethodInfo(); _schemaRegistry = A.Fake <ISchemaGenerator>(); _schemaRepository = new SchemaRepository(); var apiDescription = new ApiDescription(); foreach (var inputApiParameter in _inputApiParameters.Where(param => param.Location == ParameterLocation.Path)) { var parameterDescription = new ApiParameterDescription { Name = inputApiParameter.Name, Type = inputApiParameter.Type }; apiDescription.ParameterDescriptions.Add(parameterDescription); } _context = new OperationFilterContext(apiDescription, _schemaRegistry, _schemaRepository, method); A.CallTo(() => _schemaRegistry.GenerateSchema(A <Type> ._, _schemaRepository, A <MemberInfo> ._, A <ParameterInfo> ._)) .ReturnsLazily((Type type, SchemaRepository repository, MemberInfo memberInfo, ParameterInfo parameterInfo) => new OpenApiSchema { Type = type.Name }); _sut = new HttpFunctionPathParameterTypeFilter(); }