Skip to content

Commit

Permalink
Minor fixes to prepare release.
Browse files Browse the repository at this point in the history
  • Loading branch information
HofmeisterAn committed Mar 1, 2019
1 parent 2175439 commit c8db232
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/DotNet.Testcontainers.Tests/TestcontainersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ public async Task QueryNotExistingDockerImageByName()
[Fact]
public async Task QueryNotExistingDockerContainerByName()
{
var a = await MetaDataClientContainers.Instance.ExistsWithNameAsync(string.Empty);
Assert.False(a);
Assert.False(await MetaDataClientContainers.Instance.ExistsWithNameAsync(string.Empty));
}

[Fact]
Expand Down
16 changes: 16 additions & 0 deletions src/DotNet.Testcontainers/Core/Mapper/BaseConverter.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
namespace DotNet.Testcontainers.Core.Mapper
{
/// <summary>
/// Converts or maps the Testcontainers configuration to the official Docker configuration.
/// </summary>
/// <typeparam name="TSource">Testcontainers configuration type.</typeparam>
/// <typeparam name="TTarget">Official Docker configuration type.</typeparam>
internal abstract class BaseConverter<TSource, TTarget>
{
/// <summary>
/// Initializes a new instance of the <see cref="BaseConverter{TSource, TTarget}"/> class.
/// </summary>
/// <param name="name">Name of the converter.</param>
protected BaseConverter(string name)
{
this.Name = name;
}

/// <summary>Gets the name of the converter.</summary>
/// <value>Identifies the converter, if source and target types are frequently used.</value>
public string Name { get; }

/// <summary>
/// Converts or maps the Testcontainers configuration to the official Docker configuration.
/// </summary>
/// <param name="source">Testcontainers configuration.</param>
/// <returns>Official Docker configuration.</returns>
public abstract TTarget Convert(TSource source);
}
}
11 changes: 11 additions & 0 deletions src/DotNet.Testcontainers/Core/Mapper/CollectionConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@ namespace DotNet.Testcontainers.Core.Mapper
{
using System.Collections.Generic;

/// <summary>
/// Converts or maps Testcontainers collection configurations to official Docker configurations.
/// </summary>
/// <typeparam name="T">Official Docker configuration type.</typeparam>
internal abstract class CollectionConverter<T> : BaseConverter<IReadOnlyCollection<string>, T>
{
/// <summary>
/// Initializes a new instance of the <see cref="CollectionConverter{T}"/> class without converter name.
/// </summary>
protected CollectionConverter() : base(string.Empty)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="CollectionConverter{T}"/> class.
/// </summary>
/// <param name="name">Name of the converter.</param>
protected CollectionConverter(string name) : base(name)
{
}
Expand Down
11 changes: 11 additions & 0 deletions src/DotNet.Testcontainers/Core/Mapper/DictionaryConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@ namespace DotNet.Testcontainers.Core.Mapper
{
using System.Collections.Generic;

/// <summary>
/// Converts or maps Testcontainers dictionary configurations to official Docker configurations.
/// </summary>
/// <typeparam name="T">Official Docker configuration type.</typeparam>
internal abstract class DictionaryConverter<T> : BaseConverter<IReadOnlyDictionary<string, string>, T>
{
/// <summary>
/// Initializes a new instance of the <see cref="DictionaryConverter{T}"/> class without converter name.
/// </summary>
protected DictionaryConverter() : base(string.Empty)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="DictionaryConverter{T}"/> class.
/// </summary>
/// <param name="name">Name of the converter.</param>
protected DictionaryConverter(string name) : base(name)
{
}
Expand Down
7 changes: 0 additions & 7 deletions src/DotNet.Testcontainers/Core/Mapper/IConverter.cs

This file was deleted.

16 changes: 16 additions & 0 deletions src/DotNet.Testcontainers/Core/WaitStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ private WaitStrategy()
{
}

/// <summary>
/// Blocks while condition is true or timeout occurs.
/// </summary>
/// <param name="condition">The condition that will perpetuate the block.</param>
/// <param name="frequency">The frequency in milliseconds to check the condition.</param>
/// <param name="timeout">Timeout in milliseconds.</param>
/// <exception cref="TimeoutException">Thrown as soon as the timeout expires.</exception>
/// <returns>A task that represents the asynchronous block operation.</returns>
public static async Task WaitWhile(Func<bool> condition, int frequency = 25, int timeout = -1)
{
var waitTask = Task.Run(async () =>
Expand All @@ -25,6 +33,14 @@ public static async Task WaitWhile(Func<bool> condition, int frequency = 25, int
}
}

/// <summary>
/// Blocks until condition is true or timeout occurs.
/// </summary>
/// <param name="condition">The break condition.</param>
/// <param name="frequency">The frequency in milliseconds to check the condition.</param>
/// <param name="timeout">The timeout in milliseconds.</param>
/// <exception cref="TimeoutException">Thrown as soon as the timeout expires.</exception>
/// <returns>A task that represents the asynchronous block operation.</returns>
public static async Task WaitUntil(Func<bool> condition, int frequency = 25, int timeout = -1)
{
var waitTask = Task.Run(async () =>
Expand Down

0 comments on commit c8db232

Please sign in to comment.