static int Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Bad arguments provided."); PrintHelp(); return(1); } string openApiDocFilePath = args[0]; string outputEndpointsFilePath = args[1]; if (!ValidateArguments(openApiDocFilePath, outputEndpointsFilePath)) { PrintHelp(); return(1); } OpenApiDocument openApiDocument = OpenApiDocumentParser.ParseOpenApiDocument(openApiDocFilePath); List <Endpoint> endpoints = EndpointParser.ParseAllEndpoints(openApiDocument); string json = JsonConvert.SerializeObject(endpoints, Formatting.Indented); File.WriteAllText(outputEndpointsFilePath, json); return(0); }
public void DocumentWithTwoPathsEachHavingSingleResponseShouldReturnTwoEndpoints() { AddTwoTestingPaths(); List <Endpoint> endpoints = EndpointParser.ParseAllEndpoints(_document); Assert.AreEqual(2, endpoints.Count); }
public void DocumentWithoutAnyPathsShouldReturnEmptyList() { List <Endpoint> endpoints = EndpointParser.ParseAllEndpoints(_document); Assert.IsEmpty(endpoints); }