diff --git a/src/Testcontainers/Builders/ContainerBuilder`3.cs b/src/Testcontainers/Builders/ContainerBuilder`3.cs index 3acaebb4c..b5b8cb32a 100644 --- a/src/Testcontainers/Builders/ContainerBuilder`3.cs +++ b/src/Testcontainers/Builders/ContainerBuilder`3.cs @@ -329,7 +329,7 @@ public TBuilderEntity WithResourceMapping(Uri source, DirectoryPath target, uint var fileName = Path.GetFileName(source.LocalPath); _ = Guard.Argument(source, nameof(source)) - .ThrowIf(_ => string.IsNullOrEmpty(fileName), _ => new ArgumentException(string.Format(message, source), nameof(source))); + .ThrowIf(_ => string.IsNullOrEmpty(fileName), argument => new ArgumentException(string.Format(message, argument.Value), argument.Name)); var filePath = FilePath.Of(Path.Combine(target.Value, fileName)); return WithResourceMapping(source, filePath, uid, gid, fileMode); diff --git a/src/Testcontainers/Builders/DirectoryPath.cs b/src/Testcontainers/Builders/DirectoryPath.cs index ca0de25a6..8b41848b0 100644 --- a/src/Testcontainers/Builders/DirectoryPath.cs +++ b/src/Testcontainers/Builders/DirectoryPath.cs @@ -52,4 +52,4 @@ public override string ToString() return Value; } } -} \ No newline at end of file +} diff --git a/src/Testcontainers/Builders/DockerConfig.cs b/src/Testcontainers/Builders/DockerConfig.cs index e66173273..475890651 100644 --- a/src/Testcontainers/Builders/DockerConfig.cs +++ b/src/Testcontainers/Builders/DockerConfig.cs @@ -96,7 +96,14 @@ public Uri GetCurrentEndpoint() using (var sha256 = SHA256.Create()) { - var dockerContextHash = BitConverter.ToString(sha256.ComputeHash(Encoding.Default.GetBytes(dockerContext))).Replace("-", string.Empty).ToLowerInvariant(); + var hashBytes = sha256.ComputeHash(Encoding.Default.GetBytes(dockerContext)); + +#if NET10_0_OR_GREATER + var dockerContextHash = Convert.ToHexStringLower(hashBytes); +#else + var dockerContextHash = BitConverter.ToString(hashBytes).Replace("-", string.Empty).ToLowerInvariant(); +#endif + var metaFilePath = Path.Combine(_dockerConfigDirectoryPath, "contexts", "meta", dockerContextHash, "meta.json"); try diff --git a/src/Testcontainers/Builders/FilePath.cs b/src/Testcontainers/Builders/FilePath.cs index f487c46f6..ba3fbc00a 100644 --- a/src/Testcontainers/Builders/FilePath.cs +++ b/src/Testcontainers/Builders/FilePath.cs @@ -52,4 +52,4 @@ public override string ToString() return Value; } } -} \ No newline at end of file +} diff --git a/src/Testcontainers/Configurations/WaitStrategies/UntilDatabaseIsAvailable.cs b/src/Testcontainers/Configurations/WaitStrategies/UntilDatabaseIsAvailable.cs index c36e43bc2..9f32e5391 100644 --- a/src/Testcontainers/Configurations/WaitStrategies/UntilDatabaseIsAvailable.cs +++ b/src/Testcontainers/Configurations/WaitStrategies/UntilDatabaseIsAvailable.cs @@ -5,7 +5,7 @@ namespace DotNet.Testcontainers.Configurations using System.Threading.Tasks; using DotNet.Testcontainers.Containers; - internal class UntilDatabaseIsAvailable : IWaitUntil + internal sealed class UntilDatabaseIsAvailable : IWaitUntil { private readonly DbProviderFactory _dbProviderFactory; @@ -45,7 +45,12 @@ await connection.OpenAsync() } finally { +#if NETSTANDARD2_0 connection.Dispose(); +#else + await connection.DisposeAsync() + .ConfigureAwait(false); +#endif } } }