@@ -12,12 +12,6 @@ public sealed class ServiceBusBuilder : ContainerBuilder<ServiceBusBuilder, Serv
12
12
13
13
public const ushort ServiceBusPort = 5672 ;
14
14
15
- private const string AcceptLicenseAgreementEnvVar = "ACCEPT_EULA" ;
16
-
17
- private const string AcceptLicenseAgreement = "Y" ;
18
-
19
- private const string DeclineLicenseAgreement = "N" ;
20
-
21
15
/// <summary>
22
16
/// Initializes a new instance of the <see cref="ServiceBusBuilder" /> class.
23
17
/// </summary>
@@ -40,6 +34,15 @@ private ServiceBusBuilder(ServiceBusConfiguration resourceConfiguration)
40
34
/// <inheritdoc />
41
35
protected override ServiceBusConfiguration DockerResourceConfiguration { get ; }
42
36
37
+ /// <inheritdoc />
38
+ protected override string AcceptLicenseAgreementEnvVar { get ; } = "ACCEPT_EULA" ;
39
+
40
+ /// <inheritdoc />
41
+ protected override string AcceptLicenseAgreement { get ; } = "Y" ;
42
+
43
+ /// <inheritdoc />
44
+ protected override string DeclineLicenseAgreement { get ; } = "N" ;
45
+
43
46
/// <summary>
44
47
/// Accepts the license agreement.
45
48
/// </summary>
@@ -48,7 +51,7 @@ private ServiceBusBuilder(ServiceBusConfiguration resourceConfiguration)
48
51
/// </remarks>
49
52
/// <param name="acceptLicenseAgreement">A boolean value indicating whether the Azure Service Bus Emulator license agreement is accepted.</param>
50
53
/// <returns>A configured instance of <see cref="ServiceBusBuilder" />.</returns>
51
- public ServiceBusBuilder WithAcceptLicenseAgreement ( bool acceptLicenseAgreement )
54
+ public override ServiceBusBuilder WithAcceptLicenseAgreement ( bool acceptLicenseAgreement )
52
55
{
53
56
var licenseAgreement = acceptLicenseAgreement ? AcceptLicenseAgreement : DeclineLicenseAgreement ;
54
57
return WithEnvironment ( AcceptLicenseAgreementEnvVar , licenseAgreement ) ;
@@ -85,6 +88,7 @@ public ServiceBusBuilder WithMsSqlContainer(
85
88
public override ServiceBusContainer Build ( )
86
89
{
87
90
Validate ( ) ;
91
+ ValidateLicenseAgreement ( ) ;
88
92
89
93
if ( DockerResourceConfiguration . DatabaseContainer != null )
90
94
{
@@ -105,20 +109,6 @@ public override ServiceBusContainer Build()
105
109
return new ServiceBusContainer ( serviceBusContainer . DockerResourceConfiguration ) ;
106
110
}
107
111
108
- /// <inheritdoc />
109
- protected override void Validate ( )
110
- {
111
- const string message = "The image '{0}' requires you to accept a license agreement." ;
112
-
113
- base . Validate ( ) ;
114
-
115
- Predicate < ServiceBusConfiguration > licenseAgreementNotAccepted = value =>
116
- ! value . Environments . TryGetValue ( AcceptLicenseAgreementEnvVar , out var licenseAgreementValue ) || ! AcceptLicenseAgreement . Equals ( licenseAgreementValue , StringComparison . Ordinal ) ;
117
-
118
- _ = Guard . Argument ( DockerResourceConfiguration , nameof ( DockerResourceConfiguration . Image ) )
119
- . ThrowIf ( argument => licenseAgreementNotAccepted ( argument . Value ) , argument => throw new ArgumentException ( string . Format ( message , DockerResourceConfiguration . Image . FullName ) , argument . Name ) ) ;
120
- }
121
-
122
112
/// <inheritdoc />
123
113
protected override ServiceBusBuilder Init ( )
124
114
{
0 commit comments