in src/TestHelpers/Embedded/BaselineHelper.cs [19:37]
public static bool ShouldSetBaseline(TestContext testContext) =>
testContext.Properties.Contains(SetBaseLineSettingName) && string.Equals(testContext.Properties[SetBaseLineSettingName] as string, bool.TrueString, StringComparison.OrdinalIgnoreCase);
public static void SetBaseline(string actualLocation, string expectedLocation)
{
if (TryGetAbsolutePathRelativeToRepoRoot(actualLocation) is not { } fullActualLocation ||
TryGetAbsolutePathRelativeToRepoRoot(expectedLocation) is not { } fullExpectedLocation)
{
throw new InvalidOperationException($"Baseline update failed: Unable to determine the repo root path from directory {Environment.CurrentDirectory}");
}
if (Path.GetDirectoryName(fullExpectedLocation) is { } parentDir &&
!Directory.Exists(parentDir))
{
Directory.CreateDirectory(parentDir);
}
File.Copy(fullActualLocation, fullExpectedLocation, overwrite: true);
}