Skip to content

Commit a4fecef

Browse files
authored
[Fusion] Used MatchInlineSnapshot in ComposeCommandTests (#8494)
1 parent 8d63d28 commit a4fecef

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

src/HotChocolate/Fusion-vnext/test/Fusion.CommandLine.Tests/ComposeCommandTests.cs

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ public async Task Compose_ValidExample1_FromSpecified_ToStdOut()
3333

3434
// assert
3535
Assert.Equal(0, exitCode);
36-
Assert.Equal(
37-
s_validExample1CompositeSchema,
38-
testConsole.Out.ToString()!.ReplaceLineEndings("\n"));
36+
testConsole.Out.ToString()!.ReplaceLineEndings("\n")
37+
.MatchInlineSnapshot(s_validExample1CompositeSchema);
3938
}
4039

4140
[Fact]
@@ -56,9 +55,8 @@ public async Task Compose_ValidExample1_FromWorkingDirectory_ToStdOut()
5655

5756
// assert
5857
Assert.Equal(0, exitCode);
59-
Assert.Equal(
60-
s_validExample1CompositeSchema,
61-
testConsole.Out.ToString()!.ReplaceLineEndings("\n"));
58+
testConsole.Out.ToString()!.ReplaceLineEndings("\n")
59+
.MatchInlineSnapshot(s_validExample1CompositeSchema);
6260
}
6361

6462
[Fact]
@@ -86,9 +84,8 @@ public async Task Compose_ValidExample1_FromSpecified_ToFileInCurrentDirectory()
8684
// assert
8785
Assert.Equal(0, exitCode);
8886
Assert.True(File.Exists(filePath));
89-
Assert.Equal(
90-
s_validExample1CompositeSchema,
91-
(await File.ReadAllTextAsync(filePath)).ReplaceLineEndings("\n"));
87+
(await File.ReadAllTextAsync(filePath)).ReplaceLineEndings("\n")
88+
.MatchInlineSnapshot(s_validExample1CompositeSchema);
9289

9390
// cleanup
9491
File.Delete(filePath);
@@ -119,9 +116,8 @@ public async Task Compose_ValidExample1_FromSpecified_ToFileRelativeToCurrentDir
119116
// assert
120117
Assert.Equal(0, exitCode);
121118
Assert.True(File.Exists(filePath));
122-
Assert.Equal(
123-
s_validExample1CompositeSchema,
124-
(await File.ReadAllTextAsync(filePath)).ReplaceLineEndings("\n"));
119+
(await File.ReadAllTextAsync(filePath)).ReplaceLineEndings("\n")
120+
.MatchInlineSnapshot(s_validExample1CompositeSchema);
125121

126122
// cleanup
127123
File.Delete(filePath);
@@ -150,9 +146,8 @@ public async Task Compose_ValidExample1_FromWorkingDirectory_ToFileInWorkingDire
150146
// assert
151147
Assert.Equal(0, exitCode);
152148
Assert.True(File.Exists(filePath));
153-
Assert.Equal(
154-
s_validExample1CompositeSchema,
155-
(await File.ReadAllTextAsync(filePath)).ReplaceLineEndings("\n"));
149+
(await File.ReadAllTextAsync(filePath)).ReplaceLineEndings("\n")
150+
.MatchInlineSnapshot(s_validExample1CompositeSchema);
156151

157152
// cleanup
158153
File.Delete(filePath);
@@ -181,9 +176,8 @@ public async Task Compose_ValidExample1_FromWorkingDirectory_ToFileRelativeToWor
181176
// assert
182177
Assert.Equal(0, exitCode);
183178
Assert.True(File.Exists(filePath));
184-
Assert.Equal(
185-
s_validExample1CompositeSchema,
186-
(await File.ReadAllTextAsync(filePath)).ReplaceLineEndings("\n"));
179+
(await File.ReadAllTextAsync(filePath)).ReplaceLineEndings("\n")
180+
.MatchInlineSnapshot(s_validExample1CompositeSchema);
187181

188182
// cleanup
189183
File.Delete(filePath);
@@ -211,9 +205,8 @@ public async Task Compose_ValidExample1_FromWorkingDirectory_ToFileAtFullyQualif
211205
// assert
212206
Assert.Equal(0, exitCode);
213207
Assert.True(File.Exists(filePath));
214-
Assert.Equal(
215-
s_validExample1CompositeSchema,
216-
(await File.ReadAllTextAsync(filePath)).ReplaceLineEndings("\n"));
208+
(await File.ReadAllTextAsync(filePath)).ReplaceLineEndings("\n")
209+
.MatchInlineSnapshot(s_validExample1CompositeSchema);
217210

218211
// cleanup
219212
File.Delete(filePath);
@@ -322,9 +315,8 @@ public async Task Compose_InvalidExample1_FromWorkingDirectory_ToStdOutWithWarni
322315

323316
// assert
324317
Assert.Equal(0, exitCode);
325-
Assert.Equal(
326-
s_invalidExample1CompositeSchema,
327-
testConsole.Out.ToString()!.ReplaceLineEndings("\n"));
318+
testConsole.Out.ToString()!.ReplaceLineEndings("\n")
319+
.MatchInlineSnapshot(s_invalidExample1CompositeSchema);
328320
}
329321

330322
[Fact]

0 commit comments

Comments
 (0)