cs-codex-dist-tests/Tests/DistTestCore/DownloadedLogExtensions.cs

27 lines
788 B
C#
Raw Permalink Normal View History

2023-09-12 13:43:30 +00:00
using Core;
using NUnit.Framework;
namespace DistTestCore
{
public static class DownloadedLogExtensions
{
public static void AssertLogContains(this IDownloadedLog log, string expectedString)
{
Assert.That(log.DoesLogContain(expectedString), $"Did not find '{expectedString}' in log.");
}
2023-12-15 08:32:03 +00:00
public static void AssertLogDoesNotContain(this IDownloadedLog log, params string[] unexpectedStrings)
{
2023-12-15 08:32:03 +00:00
var errors = new List<string>();
foreach (var str in unexpectedStrings)
{
if (log.DoesLogContain(str))
{
errors.Add($"Did find '{str}' in log.");
}
}
CollectionAssert.IsEmpty(errors);
}
2023-09-12 13:43:30 +00:00
}
}