Skip to content

Commit f8a3a59

Browse files
chore(client): update test dependencies
1 parent 1bfe99f commit f8a3a59

29 files changed

+415
-124
lines changed

src/Orb.Tests/Orb.Tests.csproj

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
<PropertyGroup>
33
<IsTestProject>true</IsTestProject>
44
<IsPackable>false</IsPackable>
5+
<OutputType>Exe</OutputType>
56

6-
<!-- Run tests on net8.0, which will use the SDK's net8.0 DLL, and on net462, which will use the
7+
<!-- Run tests on net8.0, which will use the SDK's net8.0 DLL, and on net472, which will use the
78
SDK's netstandard2.0 DLL. -->
8-
<TargetFrameworks>net8.0;net462</TargetFrameworks>
9+
<TargetFrameworks>net8.0;net472</TargetFrameworks>
910
<LangVersion>12</LangVersion>
1011
<Nullable>enable</Nullable>
1112
<ImplicitUsings>disable</ImplicitUsings>
@@ -17,10 +18,11 @@
1718
<NoWarn>$(NoWarn),0618</NoWarn>
1819
</PropertyGroup>
1920
<ItemGroup>
20-
<PackageReference Include="coverlet.collector" Version="6.0.0" />
21-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
22-
<PackageReference Include="xunit" Version="2.5.3" />
23-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
21+
<PackageReference Include="coverlet.collector" Version="6.0.4" />
22+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
23+
<PackageReference Include="xunit.v3" Version="3.2.1" />
24+
<PackageReference Include="xunit.analyzers" Version="1.26.0" />
25+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" />
2426
<ProjectReference Include="..\Orb\Orb.csproj" />
2527
<Using Include="Xunit" />
2628
</ItemGroup>

src/Orb.Tests/Services/AlertServiceTest.cs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ public class AlertServiceTest : TestBase
88
[Fact]
99
public async Task Retrieve_Works()
1010
{
11-
var alert = await this.client.Alerts.Retrieve("alert_id");
11+
var alert = await this.client.Alerts.Retrieve(
12+
"alert_id",
13+
new(),
14+
TestContext.Current.CancellationToken
15+
);
1216
alert.Validate();
1317
}
1418

@@ -17,15 +21,16 @@ public async Task Update_Works()
1721
{
1822
var alert = await this.client.Alerts.Update(
1923
"alert_configuration_id",
20-
new() { Thresholds = [new(0)] }
24+
new() { Thresholds = [new(0)] },
25+
TestContext.Current.CancellationToken
2126
);
2227
alert.Validate();
2328
}
2429

2530
[Fact(Skip = "plan_version=0 breaks Prism")]
2631
public async Task List_Works()
2732
{
28-
var page = await this.client.Alerts.List();
33+
var page = await this.client.Alerts.List(new(), TestContext.Current.CancellationToken);
2934
page.Validate();
3035
}
3136

@@ -34,7 +39,8 @@ public async Task CreateForCustomer_Works()
3439
{
3540
var alert = await this.client.Alerts.CreateForCustomer(
3641
"customer_id",
37-
new() { Currency = "currency", Type = Type.CreditBalanceDepleted }
42+
new() { Currency = "currency", Type = Type.CreditBalanceDepleted },
43+
TestContext.Current.CancellationToken
3844
);
3945
alert.Validate();
4046
}
@@ -48,7 +54,8 @@ public async Task CreateForExternalCustomer_Works()
4854
{
4955
Currency = "currency",
5056
Type = AlertCreateForExternalCustomerParamsType.CreditBalanceDepleted,
51-
}
57+
},
58+
TestContext.Current.CancellationToken
5259
);
5360
alert.Validate();
5461
}
@@ -62,22 +69,31 @@ public async Task CreateForSubscription_Works()
6269
{
6370
Thresholds = [new(0)],
6471
Type = AlertCreateForSubscriptionParamsType.UsageExceeded,
65-
}
72+
},
73+
TestContext.Current.CancellationToken
6674
);
6775
alert.Validate();
6876
}
6977

7078
[Fact]
7179
public async Task Disable_Works()
7280
{
73-
var alert = await this.client.Alerts.Disable("alert_configuration_id");
81+
var alert = await this.client.Alerts.Disable(
82+
"alert_configuration_id",
83+
new(),
84+
TestContext.Current.CancellationToken
85+
);
7486
alert.Validate();
7587
}
7688

7789
[Fact]
7890
public async Task Enable_Works()
7991
{
80-
var alert = await this.client.Alerts.Enable("alert_configuration_id");
92+
var alert = await this.client.Alerts.Enable(
93+
"alert_configuration_id",
94+
new(),
95+
TestContext.Current.CancellationToken
96+
);
8197
alert.Validate();
8298
}
8399
}

src/Orb.Tests/Services/Beta/ExternalPlanIDServiceTest.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ public async Task CreatePlanVersion_Works()
99
{
1010
var planVersion = await this.client.Beta.ExternalPlanID.CreatePlanVersion(
1111
"external_plan_id",
12-
new() { Version = 0 }
12+
new() { Version = 0 },
13+
TestContext.Current.CancellationToken
1314
);
1415
planVersion.Validate();
1516
}
@@ -19,7 +20,8 @@ public async Task FetchPlanVersion_Works()
1920
{
2021
var planVersion = await this.client.Beta.ExternalPlanID.FetchPlanVersion(
2122
"version",
22-
new() { ExternalPlanID = "external_plan_id" }
23+
new() { ExternalPlanID = "external_plan_id" },
24+
TestContext.Current.CancellationToken
2325
);
2426
planVersion.Validate();
2527
}
@@ -29,7 +31,8 @@ public async Task SetDefaultPlanVersion_Works()
2931
{
3032
var plan = await this.client.Beta.ExternalPlanID.SetDefaultPlanVersion(
3133
"external_plan_id",
32-
new() { Version = 0 }
34+
new() { Version = 0 },
35+
TestContext.Current.CancellationToken
3336
);
3437
plan.Validate();
3538
}

src/Orb.Tests/Services/BetaServiceTest.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ public async Task CreatePlanVersion_Works()
99
{
1010
var planVersion = await this.client.Beta.CreatePlanVersion(
1111
"plan_id",
12-
new() { Version = 0 }
12+
new() { Version = 0 },
13+
TestContext.Current.CancellationToken
1314
);
1415
planVersion.Validate();
1516
}
@@ -19,15 +20,20 @@ public async Task FetchPlanVersion_Works()
1920
{
2021
var planVersion = await this.client.Beta.FetchPlanVersion(
2122
"version",
22-
new() { PlanID = "plan_id" }
23+
new() { PlanID = "plan_id" },
24+
TestContext.Current.CancellationToken
2325
);
2426
planVersion.Validate();
2527
}
2628

2729
[Fact]
2830
public async Task SetDefaultPlanVersion_Works()
2931
{
30-
var plan = await this.client.Beta.SetDefaultPlanVersion("plan_id", new() { Version = 0 });
32+
var plan = await this.client.Beta.SetDefaultPlanVersion(
33+
"plan_id",
34+
new() { Version = 0 },
35+
TestContext.Current.CancellationToken
36+
);
3137
plan.Validate();
3238
}
3339
}

src/Orb.Tests/Services/CouponServiceTest.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,38 @@ public class CouponServiceTest : TestBase
99
public async Task Create_Works()
1010
{
1111
var coupon = await this.client.Coupons.Create(
12-
new() { Discount = new Percentage(0), RedemptionCode = "HALFOFF" }
12+
new() { Discount = new Percentage(0), RedemptionCode = "HALFOFF" },
13+
TestContext.Current.CancellationToken
1314
);
1415
coupon.Validate();
1516
}
1617

1718
[Fact]
1819
public async Task List_Works()
1920
{
20-
var page = await this.client.Coupons.List();
21+
var page = await this.client.Coupons.List(new(), TestContext.Current.CancellationToken);
2122
page.Validate();
2223
}
2324

2425
[Fact]
2526
public async Task Archive_Works()
2627
{
27-
var coupon = await this.client.Coupons.Archive("coupon_id");
28+
var coupon = await this.client.Coupons.Archive(
29+
"coupon_id",
30+
new(),
31+
TestContext.Current.CancellationToken
32+
);
2833
coupon.Validate();
2934
}
3035

3136
[Fact]
3237
public async Task Fetch_Works()
3338
{
34-
var coupon = await this.client.Coupons.Fetch("coupon_id");
39+
var coupon = await this.client.Coupons.Fetch(
40+
"coupon_id",
41+
new(),
42+
TestContext.Current.CancellationToken
43+
);
3544
coupon.Validate();
3645
}
3746
}

src/Orb.Tests/Services/Coupons/SubscriptionServiceTest.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ public class SubscriptionServiceTest : TestBase
77
[Fact]
88
public async Task List_Works()
99
{
10-
var page = await this.client.Coupons.Subscriptions.List("coupon_id");
10+
var page = await this.client.Coupons.Subscriptions.List(
11+
"coupon_id",
12+
new(),
13+
TestContext.Current.CancellationToken
14+
);
1115
page.Validate();
1216
}
1317
}

src/Orb.Tests/Services/CreditNoteServiceTest.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,27 @@ public async Task Create_Works()
3535
},
3636
],
3737
Reason = Reason.Duplicate,
38-
}
38+
},
39+
TestContext.Current.CancellationToken
3940
);
4041
creditNote.Validate();
4142
}
4243

4344
[Fact]
4445
public async Task List_Works()
4546
{
46-
var page = await this.client.CreditNotes.List();
47+
var page = await this.client.CreditNotes.List(new(), TestContext.Current.CancellationToken);
4748
page.Validate();
4849
}
4950

5051
[Fact]
5152
public async Task Fetch_Works()
5253
{
53-
var creditNote = await this.client.CreditNotes.Fetch("credit_note_id");
54+
var creditNote = await this.client.CreditNotes.Fetch(
55+
"credit_note_id",
56+
new(),
57+
TestContext.Current.CancellationToken
58+
);
5459
creditNote.Validate();
5560
}
5661
}

src/Orb.Tests/Services/CustomerServiceTest.cs

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,63 +8,90 @@ public class CustomerServiceTest : TestBase
88
public async Task Create_Works()
99
{
1010
var customer = await this.client.Customers.Create(
11-
new() { Email = "dev@stainless.com", Name = "x" }
11+
new() { Email = "dev@stainless.com", Name = "x" },
12+
TestContext.Current.CancellationToken
1213
);
1314
customer.Validate();
1415
}
1516

1617
[Fact]
1718
public async Task Update_Works()
1819
{
19-
var customer = await this.client.Customers.Update("customer_id");
20+
var customer = await this.client.Customers.Update(
21+
"customer_id",
22+
new(),
23+
TestContext.Current.CancellationToken
24+
);
2025
customer.Validate();
2126
}
2227

2328
[Fact]
2429
public async Task List_Works()
2530
{
26-
var page = await this.client.Customers.List();
31+
var page = await this.client.Customers.List(new(), TestContext.Current.CancellationToken);
2732
page.Validate();
2833
}
2934

3035
[Fact]
3136
public async Task Delete_Works()
3237
{
33-
await this.client.Customers.Delete("customer_id");
38+
await this.client.Customers.Delete(
39+
"customer_id",
40+
new(),
41+
TestContext.Current.CancellationToken
42+
);
3443
}
3544

3645
[Fact]
3746
public async Task Fetch_Works()
3847
{
39-
var customer = await this.client.Customers.Fetch("customer_id");
48+
var customer = await this.client.Customers.Fetch(
49+
"customer_id",
50+
new(),
51+
TestContext.Current.CancellationToken
52+
);
4053
customer.Validate();
4154
}
4255

4356
[Fact]
4457
public async Task FetchByExternalID_Works()
4558
{
46-
var customer = await this.client.Customers.FetchByExternalID("external_customer_id");
59+
var customer = await this.client.Customers.FetchByExternalID(
60+
"external_customer_id",
61+
new(),
62+
TestContext.Current.CancellationToken
63+
);
4764
customer.Validate();
4865
}
4966

5067
[Fact]
5168
public async Task SyncPaymentMethodsFromGateway_Works()
5269
{
53-
await this.client.Customers.SyncPaymentMethodsFromGateway("customer_id");
70+
await this.client.Customers.SyncPaymentMethodsFromGateway(
71+
"customer_id",
72+
new(),
73+
TestContext.Current.CancellationToken
74+
);
5475
}
5576

5677
[Fact]
5778
public async Task SyncPaymentMethodsFromGatewayByExternalCustomerID_Works()
5879
{
5980
await this.client.Customers.SyncPaymentMethodsFromGatewayByExternalCustomerID(
60-
"external_customer_id"
81+
"external_customer_id",
82+
new(),
83+
TestContext.Current.CancellationToken
6184
);
6285
}
6386

6487
[Fact]
6588
public async Task UpdateByExternalID_Works()
6689
{
67-
var customer = await this.client.Customers.UpdateByExternalID("external_customer_id");
90+
var customer = await this.client.Customers.UpdateByExternalID(
91+
"external_customer_id",
92+
new(),
93+
TestContext.Current.CancellationToken
94+
);
6895
customer.Validate();
6996
}
7097
}

src/Orb.Tests/Services/Customers/BalanceTransactionServiceTest.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,20 @@ public async Task Create_Works()
1010
{
1111
var balanceTransaction = await this.client.Customers.BalanceTransactions.Create(
1212
"customer_id",
13-
new() { Amount = "amount", Type = Type.Increment }
13+
new() { Amount = "amount", Type = Type.Increment },
14+
TestContext.Current.CancellationToken
1415
);
1516
balanceTransaction.Validate();
1617
}
1718

1819
[Fact]
1920
public async Task List_Works()
2021
{
21-
var page = await this.client.Customers.BalanceTransactions.List("customer_id");
22+
var page = await this.client.Customers.BalanceTransactions.List(
23+
"customer_id",
24+
new(),
25+
TestContext.Current.CancellationToken
26+
);
2227
page.Validate();
2328
}
2429
}

0 commit comments

Comments
 (0)