diff --git a/src/Testcontainers/Builders/BuildConfiguration.cs b/src/Testcontainers/Builders/BuildConfiguration.cs
index 408fad9b3..b96a71c48 100644
--- a/src/Testcontainers/Builders/BuildConfiguration.cs
+++ b/src/Testcontainers/Builders/BuildConfiguration.cs
@@ -16,7 +16,7 @@ public static class BuildConfiguration
/// Changed configuration object. If there is no change, the previous configuration object.
public static T Combine(T oldValue, T newValue)
{
- return newValue == null ? oldValue : newValue;
+ return Equals(default(T), newValue) ? oldValue : newValue;
}
///
diff --git a/src/Testcontainers/Guard.Argument.cs b/src/Testcontainers/Guard.Argument.cs
index 8059f3ab5..d0189c5e5 100644
--- a/src/Testcontainers/Guard.Argument.cs
+++ b/src/Testcontainers/Guard.Argument.cs
@@ -56,7 +56,7 @@ public ArgumentInfo(TType value, string name)
/// True if the argument has a value; otherwise, false.
public bool HasValue()
{
- return Value != null;
+ return !Equals(default(TType), Value);
}
}
}
diff --git a/src/Testcontainers/Images/DockerImage.cs b/src/Testcontainers/Images/DockerImage.cs
index 671211af2..b37ae0c4a 100644
--- a/src/Testcontainers/Images/DockerImage.cs
+++ b/src/Testcontainers/Images/DockerImage.cs
@@ -14,6 +14,8 @@ public sealed class DockerImage : IImage
private static readonly char[] TrimChars = { ' ', ':', '/' };
+ private static readonly char[] HostnameIdentifierChars = { '.', ':' };
+
private readonly string _hubImageNamePrefix;
private readonly Lazy _lazyFullName;
@@ -86,14 +88,7 @@ public DockerImage(
.First()
.Split('/')[0];
- if (firstSegmentOfRepository.IndexOfAny(new[] { '.', ':' }) >= 0)
- {
- return firstSegmentOfRepository;
- }
- else
- {
- return null;
- }
+ return firstSegmentOfRepository.IndexOfAny(HostnameIdentifierChars) >= 0 ? firstSegmentOfRepository : null;
});
}
diff --git a/src/Testcontainers/Images/DockerfileArchive.cs b/src/Testcontainers/Images/DockerfileArchive.cs
index c752ca050..c543e17f8 100644
--- a/src/Testcontainers/Images/DockerfileArchive.cs
+++ b/src/Testcontainers/Images/DockerfileArchive.cs
@@ -55,7 +55,7 @@ public DockerfileArchive(DirectoryInfo dockerfileDirectory, FileInfo dockerfile,
throw new ArgumentException($"Directory '{dockerfileDirectory.FullName}' does not exist.");
}
- if (!dockerfileDirectory.GetFiles(dockerfile.ToString(), SearchOption.TopDirectoryOnly).Any())
+ if (dockerfileDirectory.GetFiles(dockerfile.ToString(), SearchOption.TopDirectoryOnly).Length == 0)
{
throw new ArgumentException($"{dockerfile} does not exist in '{dockerfileDirectory.FullName}'.");
}
diff --git a/tests/Testcontainers.Commons/CommonImages.cs b/tests/Testcontainers.Commons/CommonImages.cs
index 4e0416655..84e1090e2 100644
--- a/tests/Testcontainers.Commons/CommonImages.cs
+++ b/tests/Testcontainers.Commons/CommonImages.cs
@@ -3,7 +3,7 @@ namespace DotNet.Testcontainers.Commons;
[PublicAPI]
public static class CommonImages
{
- public static readonly IImage Ryuk = new DockerImage("testcontainers/ryuk:0.5.1");
+ public static readonly IImage Ryuk = new DockerImage("testcontainers/ryuk:0.6.0");
public static readonly IImage Alpine = new DockerImage("alpine:3.17");
diff --git a/tests/Testcontainers.Databases.Tests/DatabasesContainerTest.cs b/tests/Testcontainers.Databases.Tests/DatabasesContainerTest.cs
index 694f7b5ec..5aff13fd4 100644
--- a/tests/Testcontainers.Databases.Tests/DatabasesContainerTest.cs
+++ b/tests/Testcontainers.Databases.Tests/DatabasesContainerTest.cs
@@ -16,8 +16,10 @@ public void ShouldNotImplementIDatabaseContainer(Type type)
Assert.False(type.IsAssignableTo(typeof(IDatabaseContainer)), $"The type '{type.Name}' does implement the database interface.");
}
- public static IEnumerable