Skip to content

Commit 8a9305b

Browse files
committed
Added test for show command
1 parent 6a53f24 commit 8a9305b

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
<None Update="UtilityFiles\postmanCollection_ver4.json">
5454
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
5555
</None>
56+
<None Update="UtilityFiles\SampleOpenApi.yml">
57+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
58+
</None>
5659
<None Update="UtilityFiles\Todo.xml">
5760
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
5861
</None>

test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,15 @@ public void ShowCommandGeneratesMermaidDiagram()
9494
var output = reader.ReadToEnd();
9595
Assert.Contains("graph LR", output);
9696
}
97+
98+
[Fact]
99+
public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram()
100+
{
101+
var fileinfo = new FileInfo("sample.md");
102+
await OpenApiService.ShowOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", fileinfo, LogLevel.Information, new CancellationToken());
103+
104+
var output = File.ReadAllText(fileinfo.FullName);
105+
Assert.Contains("graph LR", output);
106+
}
97107
}
98108
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
openapi: 3.0.0
2+
info:
3+
title: Sample OpenApi
4+
version: 1.0.0
5+
paths:
6+
/api/editresource:
7+
get:
8+
responses:
9+
'200':
10+
description: OK
11+
patch:
12+
responses:
13+
'200':
14+
description: OK
15+
/api/viewresource:
16+
get:
17+
responses:
18+
'200':
19+
description: OK

0 commit comments

Comments
 (0)