예제 #1
0
        public void It_should_support_custom_stylesheet_injection()
        {
            var resourceAssembly = typeof(SwaggerConfig).Assembly;

            _swaggerUiConfig.InjectStylesheet(resourceAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testStyles1.css");
            _swaggerUiConfig.InjectStylesheet(resourceAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testStyles2.css");

            var content = GetAsString("http://tempuri.org/swagger/ui/index.html");

            StringAssert.Contains(
                "<link href='Swashbuckle.Dummy.SwaggerExtensions.testStyles1.css' rel='stylesheet' type='text/css'/>\r\n" +
                "<link href='Swashbuckle.Dummy.SwaggerExtensions.testStyles2.css' rel='stylesheet' type='text/css'/>",
                content);

            content = GetAsString("http://tempuri.org/swagger/ui/Swashbuckle.Dummy.SwaggerExtensions.testStyles1.css");
            StringAssert.StartsWith("h1", content);

            content = GetAsString("http://tempuri.org/swagger/ui/Swashbuckle.Dummy.SwaggerExtensions.testStyles2.css");
            StringAssert.StartsWith("h2", content);
        }
예제 #2
0
 /// <summary>
 /// Use this to enable the collector style-sheet
 /// </summary>
 /// <param name="swaggerUiConfig">
 /// The swagger User Interface Config
 /// </param>
 public static void EnableCollectorTheme(this SwaggerUiConfig swaggerUiConfig) =>
 swaggerUiConfig.InjectStylesheet(typeof(SwaggerConfigurationExtensions).Assembly, "Collector.Common.Swagger.Extensions.Resources.collectortheme.css");