public async Task CustomStylesheetsAndScriptsCanBeInjected() { var client = new TestSite(typeof(CustomAssets.Startup)).BuildClient(); var response = await client.GetAsync("/swagger/ui/index.html"); var content = await response.Content.ReadAsStringAsync(); Assert.Contains("/ext/custom-script.js", content); Assert.Contains("<link href='/ext/custom-stylesheet.css' media='screen' rel='stylesheet' type='text/css' />", content); }
public async Task SwaggerUiRequest_IncludesCustomStylesheetsAndScripts_IfConfigured() { var client = new TestSite(typeof(CustomUiConfig.Startup)).BuildClient(); var response = await client.GetAsync("/swagger/index.html"); var content = await response.Content.ReadAsStringAsync(); Assert.Contains("/ext/custom-script.js", content); Assert.Contains("<link href='/ext/custom-stylesheet.css' rel='stylesheet' media='screen' type='text/css' />", content); }
public async Task SwaggerRequest_ReturnsValidSwaggerJson( Type startupType, string swaggerRequestUri) { var testSite = new TestSite(startupType); var client = testSite.BuildClient(); var swaggerResponse = await client.GetAsync(swaggerRequestUri); swaggerResponse.EnsureSuccessStatusCode(); // NOTE: the online swagger validator INCORRECTLY returns an error for the Swagger generated // by the "Basic" sample Website. As a temporary workaround, bypass the valid swagger assertion if (startupType == typeof(Basic.Startup)) { return; } await AssertValidSwaggerAsync(swaggerResponse); }