Beispiel #1
0
        public void Given_Assembly_When_Resolve_Invoked_Then_It_Should_Return_Result()
        {
            var assembly = Assembly.GetAssembly(typeof(DefaultOpenApiConfigurationOptions));

            var result = OpenApiConfigurationResolver.Resolve(assembly);

            result.Should().BeOfType <DefaultOpenApiConfigurationOptions>();
        }
        public void Given_An_Assembly_With_An_Abstract_Base_Configuration_Then_It_Should_Return_Result()
        {
            var assembly = Assembly.GetAssembly(typeof(FakeOpenApiConfigurationOptions));

            var result = OpenApiConfigurationResolver.Resolve(assembly);

            result.Should().BeOfType <FakeOpenApiConfigurationOptions>();
            result.GetType().BaseType.Should().Be(typeof(FakeOpenApiConfigurationOptionsBase)); // This verifies the abstract type was considered in the resolution
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OpenApiAppSettingsBase"/> class.
        /// </summary>
        protected OpenApiAppSettingsBase()
            : base()
        {
            var basePath = this.GetBasePath();
            var host     = HostJsonResolver.Resolve(this.Config, basePath);
            var options  = OpenApiConfigurationResolver.Resolve(Assembly.GetExecutingAssembly());

            this.OpenApiInfo    = options.Info;
            this.SwaggerAuthKey = this.Config.GetValue <string>("OpenApi:ApiKey");

            this.HttpSettings = host.GetHttpSettings();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="OpenApiHttpTrigger"/> class.
        /// </summary>
        public OpenApiHttpTriggerContext()
        {
            var host = HostJsonResolver.Resolve();

            this.OpenApiConfiguration = OpenApiConfigurationResolver.Resolve(this.GetExecutingAssembly());
            this.HttpSettings         = host.GetHttpSettings();

            var filter   = new RouteConstraintFilter();
            var acceptor = new OpenApiSchemaAcceptor();
            var helper   = new DocumentHelper(filter, acceptor);

            this.Document  = new Document(helper);
            this.SwaggerUI = new SwaggerUI();
        }