Skip to content

Commit

Permalink
chore: Add missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HofmeisterAn committed Feb 14, 2025
1 parent 2b098b9 commit 1f7915d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/Testcontainers.Db2.Tests/DeclineLicenseAgreementTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace Testcontainers.Db2;

public sealed partial class DeclineLicenseAgreementTest
{
[GeneratedRegex("The image '.+' requires you to accept a license agreement\\.")]
private static partial Regex LicenseAgreementNotAccepted();

[Fact]
public void WithoutAcceptingLicenseAgreementThrowsArgumentException()
{
var exception = Assert.Throws<ArgumentException>(() => new Db2Builder().Build());
Assert.Matches(LicenseAgreementNotAccepted(), exception.Message);
}

[Fact]
public void WithLicenseAgreementDeclinedThrowsArgumentException()
{
var exception = Assert.Throws<ArgumentException>(() => new Db2Builder().WithAcceptLicenseAgreement(false).Build());
Assert.Matches(LicenseAgreementNotAccepted(), exception.Message);
}
}
2 changes: 2 additions & 0 deletions tests/Testcontainers.Db2.Tests/Usings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
global using System;
global using System.Data;
global using System.Text.RegularExpressions;
global using System.Data.Common;
global using System.Threading.Tasks;
global using DotNet.Testcontainers.Commons;
Expand Down

0 comments on commit 1f7915d

Please sign in to comment.