@@ -21,15 +21,6 @@ namespace Bit.Core.Test.Billing.Organizations.Queries;
2121[ SutProviderCustomize ]
2222public class GetOrganizationMetadataQueryTests
2323{
24- [ Theory , BitAutoData ]
25- public async Task Run_NullOrganization_ReturnsNull (
26- SutProvider < GetOrganizationMetadataQuery > sutProvider )
27- {
28- var result = await sutProvider . Sut . Run ( null ) ;
29-
30- Assert . Null ( result ) ;
31- }
32-
3324 [ Theory , BitAutoData ]
3425 public async Task Run_SelfHosted_ReturnsDefault (
3526 Organization organization ,
@@ -74,8 +65,7 @@ public async Task Run_NullCustomer_ReturnsDefaultWithOccupiedSeats(
7465 . Returns ( new OrganizationSeatCounts { Users = 5 , Sponsored = 0 } ) ;
7566
7667 sutProvider . GetDependency < ISubscriberService > ( )
77- . GetCustomer ( organization , Arg . Is < CustomerGetOptions > ( options =>
78- options . Expand . Contains ( "discount.coupon.applies_to" ) ) )
68+ . GetCustomer ( organization )
7969 . ReturnsNull ( ) ;
8070
8171 var result = await sutProvider . Sut . Run ( organization ) ;
@@ -100,12 +90,12 @@ public async Task Run_NullSubscription_ReturnsDefaultWithOccupiedSeats(
10090 . Returns ( new OrganizationSeatCounts { Users = 7 , Sponsored = 0 } ) ;
10191
10292 sutProvider . GetDependency < ISubscriberService > ( )
103- . GetCustomer ( organization , Arg . Is < CustomerGetOptions > ( options =>
104- options . Expand . Contains ( "discount.coupon.applies_to" ) ) )
93+ . GetCustomer ( organization )
10594 . Returns ( customer ) ;
10695
10796 sutProvider . GetDependency < ISubscriberService > ( )
108- . GetSubscription ( organization )
97+ . GetSubscription ( organization , Arg . Is < SubscriptionGetOptions > ( options =>
98+ options . Expand . Contains ( "discounts.coupon.applies_to" ) ) )
10999 . ReturnsNull ( ) ;
110100
111101 var result = await sutProvider . Sut . Run ( organization ) ;
@@ -124,23 +114,24 @@ public async Task Run_WithSecretsManagerStandaloneCoupon_ReturnsMetadataWithFlag
124114 organization . PlanType = PlanType . EnterpriseAnnually ;
125115
126116 var productId = "product_123" ;
127- var customer = new Customer
117+ var customer = new Customer ( ) ;
118+
119+ var subscription = new Subscription
128120 {
129- Discount = new Discount
130- {
131- Coupon = new Coupon
121+ Discounts =
122+ [
123+ new Discount
132124 {
133- Id = StripeConstants . CouponIDs . SecretsManagerStandalone ,
134- AppliesTo = new CouponAppliesTo
125+ Coupon = new Coupon
135126 {
136- Products = [ productId ]
127+ Id = StripeConstants . CouponIDs . SecretsManagerStandalone ,
128+ AppliesTo = new CouponAppliesTo
129+ {
130+ Products = [ productId ]
131+ }
137132 }
138133 }
139- }
140- } ;
141-
142- var subscription = new Subscription
143- {
134+ ] ,
144135 Items = new StripeList < SubscriptionItem >
145136 {
146137 Data =
@@ -162,12 +153,12 @@ public async Task Run_WithSecretsManagerStandaloneCoupon_ReturnsMetadataWithFlag
162153 . Returns ( new OrganizationSeatCounts { Users = 15 , Sponsored = 0 } ) ;
163154
164155 sutProvider . GetDependency < ISubscriberService > ( )
165- . GetCustomer ( organization , Arg . Is < CustomerGetOptions > ( options =>
166- options . Expand . Contains ( "discount.coupon.applies_to" ) ) )
156+ . GetCustomer ( organization )
167157 . Returns ( customer ) ;
168158
169159 sutProvider . GetDependency < ISubscriberService > ( )
170- . GetSubscription ( organization )
160+ . GetSubscription ( organization , Arg . Is < SubscriptionGetOptions > ( options =>
161+ options . Expand . Contains ( "discounts.coupon.applies_to" ) ) )
171162 . Returns ( subscription ) ;
172163
173164 sutProvider . GetDependency < IPricingClient > ( )
@@ -189,13 +180,11 @@ public async Task Run_WithoutSecretsManagerStandaloneCoupon_ReturnsMetadataWitho
189180 organization . GatewaySubscriptionId = "sub_123" ;
190181 organization . PlanType = PlanType . TeamsAnnually ;
191182
192- var customer = new Customer
193- {
194- Discount = null
195- } ;
183+ var customer = new Customer ( ) ;
196184
197185 var subscription = new Subscription
198186 {
187+ Discounts = null ,
199188 Items = new StripeList < SubscriptionItem >
200189 {
201190 Data =
@@ -217,12 +206,12 @@ public async Task Run_WithoutSecretsManagerStandaloneCoupon_ReturnsMetadataWitho
217206 . Returns ( new OrganizationSeatCounts { Users = 20 , Sponsored = 0 } ) ;
218207
219208 sutProvider . GetDependency < ISubscriberService > ( )
220- . GetCustomer ( organization , Arg . Is < CustomerGetOptions > ( options =>
221- options . Expand . Contains ( "discount.coupon.applies_to" ) ) )
209+ . GetCustomer ( organization )
222210 . Returns ( customer ) ;
223211
224212 sutProvider . GetDependency < ISubscriberService > ( )
225- . GetSubscription ( organization )
213+ . GetSubscription ( organization , Arg . Is < SubscriptionGetOptions > ( options =>
214+ options . Expand . Contains ( "discounts.coupon.applies_to" ) ) )
226215 . Returns ( subscription ) ;
227216
228217 sutProvider . GetDependency < IPricingClient > ( )
@@ -244,23 +233,24 @@ public async Task Run_CouponDoesNotApplyToSubscriptionProducts_ReturnsFalseForSt
244233 organization . GatewaySubscriptionId = "sub_123" ;
245234 organization . PlanType = PlanType . EnterpriseAnnually ;
246235
247- var customer = new Customer
236+ var customer = new Customer ( ) ;
237+
238+ var subscription = new Subscription
248239 {
249- Discount = new Discount
250- {
251- Coupon = new Coupon
240+ Discounts =
241+ [
242+ new Discount
252243 {
253- Id = StripeConstants . CouponIDs . SecretsManagerStandalone ,
254- AppliesTo = new CouponAppliesTo
244+ Coupon = new Coupon
255245 {
256- Products = [ "different_product_id" ]
246+ Id = StripeConstants . CouponIDs . SecretsManagerStandalone ,
247+ AppliesTo = new CouponAppliesTo
248+ {
249+ Products = [ "different_product_id" ]
250+ }
257251 }
258252 }
259- }
260- } ;
261-
262- var subscription = new Subscription
263- {
253+ ] ,
264254 Items = new StripeList < SubscriptionItem >
265255 {
266256 Data =
@@ -282,12 +272,12 @@ public async Task Run_CouponDoesNotApplyToSubscriptionProducts_ReturnsFalseForSt
282272 . Returns ( new OrganizationSeatCounts { Users = 12 , Sponsored = 0 } ) ;
283273
284274 sutProvider . GetDependency < ISubscriberService > ( )
285- . GetCustomer ( organization , Arg . Is < CustomerGetOptions > ( options =>
286- options . Expand . Contains ( "discount.coupon.applies_to" ) ) )
275+ . GetCustomer ( organization )
287276 . Returns ( customer ) ;
288277
289278 sutProvider . GetDependency < ISubscriberService > ( )
290- . GetSubscription ( organization )
279+ . GetSubscription ( organization , Arg . Is < SubscriptionGetOptions > ( options =>
280+ options . Expand . Contains ( "discounts.coupon.applies_to" ) ) )
291281 . Returns ( subscription ) ;
292282
293283 sutProvider . GetDependency < IPricingClient > ( )
@@ -310,23 +300,24 @@ public async Task Run_PlanDoesNotSupportSecretsManager_ReturnsFalseForStandalone
310300 organization . PlanType = PlanType . FamiliesAnnually ;
311301
312302 var productId = "product_123" ;
313- var customer = new Customer
303+ var customer = new Customer ( ) ;
304+
305+ var subscription = new Subscription
314306 {
315- Discount = new Discount
316- {
317- Coupon = new Coupon
307+ Discounts =
308+ [
309+ new Discount
318310 {
319- Id = StripeConstants . CouponIDs . SecretsManagerStandalone ,
320- AppliesTo = new CouponAppliesTo
311+ Coupon = new Coupon
321312 {
322- Products = [ productId ]
313+ Id = StripeConstants . CouponIDs . SecretsManagerStandalone ,
314+ AppliesTo = new CouponAppliesTo
315+ {
316+ Products = [ productId ]
317+ }
323318 }
324319 }
325- }
326- } ;
327-
328- var subscription = new Subscription
329- {
320+ ] ,
330321 Items = new StripeList < SubscriptionItem >
331322 {
332323 Data =
@@ -348,12 +339,12 @@ public async Task Run_PlanDoesNotSupportSecretsManager_ReturnsFalseForStandalone
348339 . Returns ( new OrganizationSeatCounts { Users = 8 , Sponsored = 0 } ) ;
349340
350341 sutProvider . GetDependency < ISubscriberService > ( )
351- . GetCustomer ( organization , Arg . Is < CustomerGetOptions > ( options =>
352- options . Expand . Contains ( "discount.coupon.applies_to" ) ) )
342+ . GetCustomer ( organization )
353343 . Returns ( customer ) ;
354344
355345 sutProvider . GetDependency < ISubscriberService > ( )
356- . GetSubscription ( organization )
346+ . GetSubscription ( organization , Arg . Is < SubscriptionGetOptions > ( options =>
347+ options . Expand . Contains ( "discounts.coupon.applies_to" ) ) )
357348 . Returns ( subscription ) ;
358349
359350 sutProvider . GetDependency < IPricingClient > ( )
0 commit comments