mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-11-15 17:00:38 +00:00
Strip out MS-CAB extraction test even further
This will make it so that exceptions are surfaced directly into the test log and cancel right away. It effectively does the same thing as capturing the error log and redirecting it, but with many less steps.
This commit is contained in:
@@ -68,16 +68,9 @@ namespace SabreTools.Wrappers.Test
|
||||
var cabinet = MicrosoftCabinet.Create(File.ReadAllBytes(path), 0);
|
||||
Assert.NotNull(cabinet);
|
||||
|
||||
// Extract catches the exception and only writes it to the console
|
||||
string outputDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
|
||||
var originalError = Console.Error;
|
||||
var error = new StringWriter();
|
||||
Console.SetError(error);
|
||||
cabinet.Extract(outputDirectory, includeDebug: true);
|
||||
Console.SetError(originalError);
|
||||
|
||||
// Assert.True shows the whole exception, Assert.Empty cuts it off
|
||||
Assert.True(error.ToString().Length == 0, error.ToString());
|
||||
Assert.Equal("Hello, ", File.ReadAllText(Path.Combine(outputDirectory, "a.txt")));
|
||||
Assert.Equal("World!", File.ReadAllText(Path.Combine(outputDirectory, "b.txt")));
|
||||
Directory.Delete(outputDirectory, recursive: true);
|
||||
|
||||
Reference in New Issue
Block a user