-
-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add WithAcceptLicenseAgreement(bool) to container builder (#1370)
- Loading branch information
1 parent
7715969
commit fa65855
Showing
16 changed files
with
142 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
tests/Testcontainers.Db2.Tests/DeclineLicenseAgreementTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tests/Testcontainers.Platform.Linux.Tests/AcceptLicenseAgreementTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Testcontainers.Tests; | ||
|
||
public sealed class AcceptLicenseAgreementTest | ||
{ | ||
[Fact] | ||
public void WithLicenseAgreementAcceptedThrowsArgumentException() | ||
{ | ||
var exception = Assert.Throws<InvalidOperationException>(() => new ContainerBuilder().WithAcceptLicenseAgreement(true).Build()); | ||
Assert.Equal("The module does not require you to accept a license agreement.", exception.Message); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/Testcontainers.ServiceBus.Tests/DeclineLicenseAgreementTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace Testcontainers.ServiceBus; | ||
|
||
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 ServiceBusBuilder().Build()); | ||
Assert.Matches(LicenseAgreementNotAccepted(), exception.Message); | ||
} | ||
|
||
[Fact] | ||
public void WithLicenseAgreementDeclinedThrowsArgumentException() | ||
{ | ||
var exception = Assert.Throws<ArgumentException>(() => new ServiceBusBuilder().WithAcceptLicenseAgreement(false).Build()); | ||
Assert.Matches(LicenseAgreementNotAccepted(), exception.Message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters