Skip to content

Commit 3139596

Browse files
chore(client): refactor union instantiation
1 parent 7bb7a9d commit 3139596

File tree

116 files changed

+44327
-48593
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+44327
-48593
lines changed

src/Orb.Tests/Models/AdjustmentIntervalTest.cs

Lines changed: 202 additions & 224 deletions
Large diffs are not rendered by default.

src/Orb.Tests/Models/Beta/BetaCreatePlanVersionParamsTest.cs

Lines changed: 6099 additions & 6613 deletions
Large diffs are not rendered by default.

src/Orb.Tests/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsTest.cs

Lines changed: 6099 additions & 6613 deletions
Large diffs are not rendered by default.

src/Orb.Tests/Models/Beta/PlanVersionTest.cs

Lines changed: 204 additions & 230 deletions
Large diffs are not rendered by default.

src/Orb.Tests/Models/ChangedSubscriptionResourcesTest.cs

Lines changed: 266 additions & 302 deletions
Large diffs are not rendered by default.

src/Orb.Tests/Models/Coupons/CouponCreateParamsTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,21 @@ public class DiscountTest : TestBase
8181
[Fact]
8282
public void PercentageValidationWorks()
8383
{
84-
Discount value = new(new Percentage(0));
84+
Discount value = new Percentage(0);
8585
value.Validate();
8686
}
8787

8888
[Fact]
8989
public void AmountValidationWorks()
9090
{
91-
Discount value = new(new Amount("amount_discount"));
91+
Discount value = new Amount("amount_discount");
9292
value.Validate();
9393
}
9494

9595
[Fact]
9696
public void PercentageSerializationRoundtripWorks()
9797
{
98-
Discount value = new(new Percentage(0));
98+
Discount value = new Percentage(0);
9999
string element = JsonSerializer.Serialize(value);
100100
var deserialized = JsonSerializer.Deserialize<Discount>(element);
101101

@@ -105,7 +105,7 @@ public void PercentageSerializationRoundtripWorks()
105105
[Fact]
106106
public void AmountSerializationRoundtripWorks()
107107
{
108-
Discount value = new(new Amount("amount_discount"));
108+
Discount value = new Amount("amount_discount");
109109
string element = JsonSerializer.Serialize(value);
110110
var deserialized = JsonSerializer.Deserialize<Discount>(element);
111111

src/Orb.Tests/Models/Coupons/CouponTest.cs

Lines changed: 64 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -206,72 +206,66 @@ public class CouponDiscountTest : TestBase
206206
[Fact]
207207
public void PercentageValidationWorks()
208208
{
209-
CouponDiscount value = new(
210-
new PercentageDiscount()
211-
{
212-
DiscountType = PercentageDiscountDiscountType.Percentage,
213-
PercentageDiscountValue = 0.15,
214-
AppliesToPriceIds = ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"],
215-
Filters =
216-
[
217-
new()
218-
{
219-
Field = PercentageDiscountFilterField.PriceID,
220-
Operator = PercentageDiscountFilterOperator.Includes,
221-
Values = ["string"],
222-
},
223-
],
224-
Reason = "reason",
225-
}
226-
);
209+
CouponDiscount value = new PercentageDiscount()
210+
{
211+
DiscountType = PercentageDiscountDiscountType.Percentage,
212+
PercentageDiscountValue = 0.15,
213+
AppliesToPriceIds = ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"],
214+
Filters =
215+
[
216+
new()
217+
{
218+
Field = PercentageDiscountFilterField.PriceID,
219+
Operator = PercentageDiscountFilterOperator.Includes,
220+
Values = ["string"],
221+
},
222+
],
223+
Reason = "reason",
224+
};
227225
value.Validate();
228226
}
229227

230228
[Fact]
231229
public void AmountValidationWorks()
232230
{
233-
CouponDiscount value = new(
234-
new AmountDiscount()
235-
{
236-
AmountDiscountValue = "amount_discount",
237-
DiscountType = DiscountType.Amount,
238-
AppliesToPriceIds = ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"],
239-
Filters =
240-
[
241-
new()
242-
{
243-
Field = AmountDiscountFilterField.PriceID,
244-
Operator = AmountDiscountFilterOperator.Includes,
245-
Values = ["string"],
246-
},
247-
],
248-
Reason = "reason",
249-
}
250-
);
231+
CouponDiscount value = new AmountDiscount()
232+
{
233+
AmountDiscountValue = "amount_discount",
234+
DiscountType = DiscountType.Amount,
235+
AppliesToPriceIds = ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"],
236+
Filters =
237+
[
238+
new()
239+
{
240+
Field = AmountDiscountFilterField.PriceID,
241+
Operator = AmountDiscountFilterOperator.Includes,
242+
Values = ["string"],
243+
},
244+
],
245+
Reason = "reason",
246+
};
251247
value.Validate();
252248
}
253249

254250
[Fact]
255251
public void PercentageSerializationRoundtripWorks()
256252
{
257-
CouponDiscount value = new(
258-
new PercentageDiscount()
259-
{
260-
DiscountType = PercentageDiscountDiscountType.Percentage,
261-
PercentageDiscountValue = 0.15,
262-
AppliesToPriceIds = ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"],
263-
Filters =
264-
[
265-
new()
266-
{
267-
Field = PercentageDiscountFilterField.PriceID,
268-
Operator = PercentageDiscountFilterOperator.Includes,
269-
Values = ["string"],
270-
},
271-
],
272-
Reason = "reason",
273-
}
274-
);
253+
CouponDiscount value = new PercentageDiscount()
254+
{
255+
DiscountType = PercentageDiscountDiscountType.Percentage,
256+
PercentageDiscountValue = 0.15,
257+
AppliesToPriceIds = ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"],
258+
Filters =
259+
[
260+
new()
261+
{
262+
Field = PercentageDiscountFilterField.PriceID,
263+
Operator = PercentageDiscountFilterOperator.Includes,
264+
Values = ["string"],
265+
},
266+
],
267+
Reason = "reason",
268+
};
275269
string element = JsonSerializer.Serialize(value);
276270
var deserialized = JsonSerializer.Deserialize<CouponDiscount>(element);
277271

@@ -281,24 +275,22 @@ public void PercentageSerializationRoundtripWorks()
281275
[Fact]
282276
public void AmountSerializationRoundtripWorks()
283277
{
284-
CouponDiscount value = new(
285-
new AmountDiscount()
286-
{
287-
AmountDiscountValue = "amount_discount",
288-
DiscountType = DiscountType.Amount,
289-
AppliesToPriceIds = ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"],
290-
Filters =
291-
[
292-
new()
293-
{
294-
Field = AmountDiscountFilterField.PriceID,
295-
Operator = AmountDiscountFilterOperator.Includes,
296-
Values = ["string"],
297-
},
298-
],
299-
Reason = "reason",
300-
}
301-
);
278+
CouponDiscount value = new AmountDiscount()
279+
{
280+
AmountDiscountValue = "amount_discount",
281+
DiscountType = DiscountType.Amount,
282+
AppliesToPriceIds = ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"],
283+
Filters =
284+
[
285+
new()
286+
{
287+
Field = AmountDiscountFilterField.PriceID,
288+
Operator = AmountDiscountFilterOperator.Includes,
289+
Values = ["string"],
290+
},
291+
],
292+
Reason = "reason",
293+
};
302294
string element = JsonSerializer.Serialize(value);
303295
var deserialized = JsonSerializer.Deserialize<CouponDiscount>(element);
304296

0 commit comments

Comments
 (0)