Beispiel #1
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 openapi  = OpenApiSettingsJsonResolver.Resolve(this.Config, basePath);

            this.OpenApiInfo    = OpenApiInfoResolver.Resolve(host, openapi, this.Config);
            this.SwaggerAuthKey = this.Config.GetValue <string>("OpenApi:ApiKey");

            this.HttpSettings = host.GetHttpSettings();
        }
        public void Given_Parameters_When_Resolve_Invoked_Then_It_Should_Return_Result()
        {
            var section = new Mock <IConfigurationSection>();

            section.SetupGet(p => p.Value).Returns(string.Empty);

            var env = new Mock <IConfiguration>();

            env.Setup(p => p.GetSection(It.IsAny <string>())).Returns(section.Object);

            var result = OpenApiSettingsJsonResolver.Resolve(env.Object);

            result.Should().NotBeNull()
            .And.BeAssignableTo <IConfiguration>();
        }