Skip to content

Commit

Permalink
Use SourceFileName.OfThis.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcweber committed Dec 19, 2024
1 parent 9a84dcb commit d6cdda5
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions test/Tests.Fixtures/DockerfileTestContainerFixture.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
using System.Runtime.CompilerServices;

using DotNet.Testcontainers.Builders;
using DotNet.Testcontainers.Builders;
using DotNet.Testcontainers.Images;

using ExRam.Gremlinq.Tests.Infrastructure;

namespace ExRam.Gremlinq.Tests.Fixtures
{
public abstract class DockerfileTestContainerFixture : TestContainerFixtureBase
{
private readonly string _dockerfile;
private readonly string _callerFilePath;

protected DockerfileTestContainerFixture(string dockerfile, int port = 8182) : this(dockerfile, port, 0)
{
}

private DockerfileTestContainerFixture(string dockerfile, int port = 8182, int _ = 0, [CallerFilePath] string callerFilePath = "") : base(port)
protected DockerfileTestContainerFixture(string dockerfile, int port = 8182) : base(port)
{
_dockerfile = dockerfile;
_callerFilePath = callerFilePath;
}

protected override async Task<IImage> GetImage()
{
var futureImage = new ImageFromDockerfileBuilder()
.WithDockerfileDirectory(Path.Combine(Path.GetDirectoryName(_callerFilePath)!, "Dockerfiles"))
.WithDockerfileDirectory(Path.Combine(Path.GetDirectoryName(SourceFileName.OfThis())!, "Dockerfiles"))
.WithDockerfile(_dockerfile)
.Build();

Expand Down

0 comments on commit d6cdda5

Please sign in to comment.