Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWPF>true</UseWPF>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void ReturnFilteredOpenApiDocumentBasedOnOperationIdsAndTags(string opera
public void ReturnFilteredOpenApiDocumentBasedOnPostmanCollection()
{
// Arrange
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver2.json");
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver2.json");
var fileInput = new FileInfo(filePath);
var stream = fileInput.OpenRead();

Expand Down Expand Up @@ -107,7 +107,7 @@ public void TestPredicateFiltersUsingRelativeRequestUrls()
public void ShouldParseNestedPostmanCollection()
{
// Arrange
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver3.json");
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver3.json");
var fileInput = new FileInfo(filePath);
var stream = fileInput.OpenRead();

Expand All @@ -124,7 +124,7 @@ public void ShouldParseNestedPostmanCollection()
public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument()
{
// Arrange
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver1.json");
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver1.json");
var fileInput = new FileInfo(filePath);
var stream = fileInput.OpenRead();

Expand All @@ -141,7 +141,7 @@ public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument()
public void ContinueProcessingWhenUrlsInCollectionAreMissingFromSourceDocument()
{
// Arrange
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver4.json");
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver4.json");
var fileInput = new FileInfo(filePath);
var stream = fileInput.OpenRead();

Expand Down
33 changes: 18 additions & 15 deletions test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public OpenApiServiceTests()
public async Task ReturnConvertedCSDLFile()
{
// Arrange
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml");
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "Todo.xml");
var fileInput = new FileInfo(filePath);
var csdlStream = fileInput.OpenRead();
// Act
Expand All @@ -50,7 +50,7 @@ public async Task ReturnConvertedCSDLFile()
public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount)
{
// Arrange
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml");
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "Todo.xml");
var fileInput = new FileInfo(filePath);
var csdlStream = fileInput.OpenRead();

Expand Down Expand Up @@ -137,7 +137,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram()
// create a dummy ILogger instance for testing
var options = new HidiOptions()
{
OpenApi = "UtilityFiles\\SampleOpenApi.yml",
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
Output = new FileInfo("sample.md")
};

Expand All @@ -152,7 +152,7 @@ public async Task ShowCommandGeneratesMermaidHtmlFileWithMermaidDiagram()
{
var options = new HidiOptions()
{
OpenApi = "UtilityFiles\\SampleOpenApi.yml"
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml")
};
var filePath = await OpenApiService.ShowOpenApiDocument(options, _logger, new CancellationToken());
Assert.True(File.Exists(filePath));
Expand All @@ -163,7 +163,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiag
{
var options = new HidiOptions()
{
Csdl = "UtilityFiles\\Todo.xml",
Csdl = Path.Combine("UtilityFiles", "Todo.xml"),
CsdlFilter = "todos",
Output = new FileInfo("sample.md")
};
Expand Down Expand Up @@ -201,7 +201,7 @@ await Assert.ThrowsAsync<InvalidOperationException>(async () =>
public async Task ValidateCommandProcessesOpenApi()
{
// create a dummy ILogger instance for testing
await OpenApiService.ValidateOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", _logger, new CancellationToken());
await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger, new CancellationToken());

Assert.True(true);
}
Expand All @@ -212,7 +212,7 @@ public async Task TransformCommandConvertsOpenApi()
{
HidiOptions options = new HidiOptions
{
OpenApi = "UtilityFiles\\SampleOpenApi.yml",
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
Output = new FileInfo("sample.json"),
CleanOutput = true,
TerseOutput = false,
Expand All @@ -232,7 +232,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputname()
{
HidiOptions options = new HidiOptions
{
OpenApi = "UtilityFiles\\SampleOpenApi.yml",
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
CleanOutput = true,
TerseOutput = false,
InlineLocal = false,
Expand All @@ -250,7 +250,7 @@ public async Task TransformCommandConvertsCsdlWithDefaultOutputname()
{
HidiOptions options = new HidiOptions
{
Csdl = "UtilityFiles\\Todo.xml",
Csdl = Path.Combine("UtilityFiles", "Todo.xml"),
CleanOutput = true,
TerseOutput = false,
InlineLocal = false,
Expand All @@ -268,7 +268,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputnameAndSwitchF
{
HidiOptions options = new HidiOptions
{
OpenApi = "UtilityFiles\\SampleOpenApi.yml",
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
CleanOutput = true,
Version = "3.0",
OpenApiFormat = OpenApiFormat.Yaml,
Expand Down Expand Up @@ -301,10 +301,10 @@ await Assert.ThrowsAsync<ArgumentException>(async () =>
[Fact]
public async Task TransformToPowerShellCompliantOpenApi()
{
var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\examplepowershellsettings.json");
var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "examplepowershellsettings.json");
HidiOptions options = new HidiOptions
{
OpenApi = "UtilityFiles\\SampleOpenApi.yml",
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
CleanOutput = true,
Version = "3.0",
OpenApiFormat = OpenApiFormat.Yaml,
Expand All @@ -324,7 +324,8 @@ public async Task TransformToPowerShellCompliantOpenApi()
public void InvokeTransformCommand()
{
var rootCommand = Program.CreateRootCommand();
var args = new string[] { "transform", "-d", ".\\UtilityFiles\\SampleOpenApi.yml", "-o", "sample.json", "--co" };
var openapi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml");
var args = new string[] { "transform", "-d", openapi, "-o", "sample.json", "--co" };
var parseResult = rootCommand.Parse(args);
var handler = rootCommand.Subcommands.Where(c => c.Name == "transform").First().Handler;
var context = new InvocationContext(parseResult);
Expand All @@ -340,7 +341,8 @@ public void InvokeTransformCommand()
public void InvokeShowCommand()
{
var rootCommand = Program.CreateRootCommand();
var args = new string[] { "show", "-d", ".\\UtilityFiles\\SampleOpenApi.yml", "-o", "sample.md" };
var openapi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml");
var args = new string[] { "show", "-d", openapi, "-o", "sample.md" };
var parseResult = rootCommand.Parse(args);
var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler;
var context = new InvocationContext(parseResult);
Expand All @@ -355,7 +357,8 @@ public void InvokeShowCommand()
public void InvokePluginCommand()
{
var rootCommand = Program.CreateRootCommand();
var args = new string[] { "plugin", "-m", ".\\UtilityFiles\\exampleapimanifest.json", "--of", AppDomain.CurrentDomain.BaseDirectory };
var manifest = Path.Combine(".", "UtilityFiles", "exampleapimanifest.json");
var args = new string[] { "plugin", "-m", manifest, "--of", AppDomain.CurrentDomain.BaseDirectory };
var parseResult = rootCommand.Parse(args);
var handler = rootCommand.Subcommands.Where(c => c.Name == "plugin").First().Handler;
var context = new InvocationContext(parseResult);
Expand Down