[x] I have verified that I am running the latest version of DisposableFixer: 1.1.3
[x] I have searched open and closed issues to ensure it has not already been reported
Description
When executing Wrap in using CodeFix, nothing happens.
Source Code
using System;
using System.Collections.Generic;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.Owin.Testing;
namespace SwaggerFileGenerator {
class Program {
private static async Task<(string route, string response)[]> GetRoutesFromServer(TestServer server) {
var rootResponse = await server.CreateRequest(string.Empty).GetAsync();
if (rootResponse.StatusCode != HttpStatusCode.MovedPermanently) {
throw new Exception("Unable to retrieve Url to SwaggerUI. Expect root of server to contain redirect to swagger ui.");
}
var swaggerUiResponse = await server.CreateRequest(rootResponse.Headers.Location.ToString()).GetAsync();
var swaggerUi = await swaggerUiResponse.Content.ReadAsStringAsync();
var regex = new Regex("discoveryPaths\\:\\sarrayFrom\\(\\\'(?<paths>([a-zA-Z\\/0-9]*))\\\'\\).");
var match = regex.Match(swaggerUi);
if (!match.Success) {
throw new Exception("Unable to retrieve routes from SwaggerUI. Maybe content changed."+Environment.NewLine+swaggerUi);
}
var paths = match.Groups["paths"].Value;
var result = new List<(string route, string response)>();
foreach (var path in paths.Split(',')) {
using (var routeResponse = await server.CreateRequest(path).GetAsync()) {
var response = await routeResponse.Content.ReadAsStringAsync();
result.Add((path, response));
}
}
return result.ToArray();
}
}
}
Prerequisites
Description
When executing Wrap in using CodeFix, nothing happens.
Source Code
Screenshot