diff --git a/test/Providers.GremlinServer.Tests/IntegrationTests.cs b/test/Providers.GremlinServer.Tests/IntegrationTests.cs index aa1903abc..1f03160ae 100644 --- a/test/Providers.GremlinServer.Tests/IntegrationTests.cs +++ b/test/Providers.GremlinServer.Tests/IntegrationTests.cs @@ -15,7 +15,7 @@ namespace ExRam.Gremlinq.Providers.GremlinServer.Tests { [IntegrationTest("Linux", true)] [IntegrationTest("Windows")] - public class IntegrationTests : QueryExecutionTest, IClassFixture + public class IntegrationTests : QueryExecutionTest, IClassFixture, ISourceFileNameProvider { public IntegrationTests(GremlinServerContainerFixture fixture) : base( fixture, @@ -23,7 +23,7 @@ public IntegrationTests(GremlinServerContainerFixture fixture) : base( { } - public static string ThisFilePath() => ThisFile.GetName(); + public static string GetSourceFileName() => ThisFile.GetName(); [Fact] public async Task FirstAsync() => (await _g diff --git a/test/Tests.Infrastructure/Extensions/SettingsTaskExtensions.cs b/test/Tests.Infrastructure/Extensions/SettingsTaskExtensions.cs index 4cb6df175..125af3503 100644 --- a/test/Tests.Infrastructure/Extensions/SettingsTaskExtensions.cs +++ b/test/Tests.Infrastructure/Extensions/SettingsTaskExtensions.cs @@ -9,5 +9,17 @@ public static class SettingsTaskExtensions public static SettingsTask ScrubRegex(this SettingsTask task, Regex regex, string replacement) => task.ScrubLinesWithReplace(str => regex.Replace(str, replacement)); public static SettingsTask ScrubGuids(this SettingsTask task) => task.ScrubRegex(GuidRegex, "12345678-9012-3456-7890-123456789012"); + + public static SettingsTask UseSnapshotDirectoryOf(this SettingsTask task) where T : ISourceFileNameProvider + { + if (Path.GetDirectoryName(T.GetSourceFileName()) is { } directory) + { + return task + .UseDirectory(directory) + .UseTypeName(typeof(T).Name); + } + + throw new InvalidOperationException(); + } } } diff --git a/test/Tests.Infrastructure/ISourceFileNameProvider.cs b/test/Tests.Infrastructure/ISourceFileNameProvider.cs new file mode 100644 index 000000000..2bdb5a271 --- /dev/null +++ b/test/Tests.Infrastructure/ISourceFileNameProvider.cs @@ -0,0 +1,8 @@ +#pragma warning disable CA2252 +namespace ExRam.Gremlinq.Tests.Infrastructure +{ + public interface ISourceFileNameProvider + { + static abstract string GetSourceFileName(); + } +}