Checking for all unwanted log entries

This commit is contained in:
benbierens 2023-12-15 09:32:03 +01:00
parent b143136590
commit d67ddab290
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
1 changed files with 10 additions and 2 deletions

View File

@ -10,9 +10,17 @@ namespace DistTestCore
Assert.That(log.DoesLogContain(expectedString), $"Did not find '{expectedString}' in log.");
}
public static void AssertLogDoesNotContain(this IDownloadedLog log, string unexpectedString)
public static void AssertLogDoesNotContain(this IDownloadedLog log, params string[] unexpectedStrings)
{
Assert.That(!log.DoesLogContain(unexpectedString), $"Did find '{unexpectedString}' in log.");
var errors = new List<string>();
foreach (var str in unexpectedStrings)
{
if (log.DoesLogContain(str))
{
errors.Add($"Did find '{str}' in log.");
}
}
CollectionAssert.IsEmpty(errors);
}
}
}