Skip to content

Commit 5a7bbc8

Browse files
committed
Skipping tests on unsupported platforms
1 parent ac32dbc commit 5a7bbc8

File tree

8 files changed

+239
-229
lines changed

8 files changed

+239
-229
lines changed

‎ChinookDatabase.Test/ChinookDatabase.Test.csproj‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<PrivateAssets>all</PrivateAssets>
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2323
</PackageReference>
24+
<PackageReference Include="Xunit.SkippableFact" Version="1.5.23" />
2425
</ItemGroup>
2526

2627
<ItemGroup>
@@ -60,23 +61,18 @@
6061
<Message Text="Generating test T4 templates..." Importance="high" />
6162

6263
<!-- Generate DatabaseFixture test files -->
63-
<Exec Command="t4 -r=&quot;$(NewtonsoftJsonDll)&quot; -r=&quot;$(VisualStudioInteropDll)&quot; DatabaseFixture.tt"
64-
ContinueOnError="false"
65-
WorkingDirectory="$(MSBuildProjectDirectory)/DatabaseTests" />
64+
<Exec Command="t4 -r=&quot;$(NewtonsoftJsonDll)&quot; -r=&quot;$(VisualStudioInteropDll)&quot; DatabaseFixture.tt" ContinueOnError="false" WorkingDirectory="$(MSBuildProjectDirectory)/DatabaseTests" />
6665

6766
<Message Text="Test T4 templates generated successfully" Importance="high" />
6867
</Target>
6968

7069
<!-- Check if t4 tool is available -->
7170
<Target Name="CheckT4Tool" BeforeTargets="GenerateT4Templates">
72-
<Exec Command="echo dotnet-t4 is installed | t4 -o -"
73-
ContinueOnError="true"
74-
IgnoreExitCode="true">
71+
<Exec Command="echo dotnet-t4 is installed | t4 -o -" ContinueOnError="true" IgnoreExitCode="true">
7572
<Output TaskParameter="ExitCode" PropertyName="T4ExitCode" />
7673
</Exec>
7774

78-
<Error Text="T4 command line tool not found. Please install it with: dotnet tool install -g dotnet-t4"
79-
Condition="$(T4ExitCode) != 0" />
75+
<Error Text="T4 command line tool not found. Please install it with: dotnet tool install -g dotnet-t4" Condition="$(T4ExitCode) != 0" />
8076
</Target>
8177

8278
</Project>

‎ChinookDatabase.Test/DatabaseTests/ChinookDb2Fixture.cs‎

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public partial class ChinookDb2Fixture : IDisposable
3030
/// <returns>A connection object for this specific database.</returns>
3131
protected DB2Connection GetConnection(string connectionName)
3232
{
33+
var currentPlatform = System.Runtime.InteropServices.RuntimeInformation.RuntimeIdentifier;
34+
var skipPlatforms = new[] { "osx-arm64" };
35+
Skip.If(skipPlatforms.Contains(currentPlatform), $"Skipped on {currentPlatform} - native libraries not available");
3336
// Creates an ADO.NET connection to the database, if not created yet.
3437
if (Connections.ContainsKey(connectionName))
3538
{
@@ -84,7 +87,7 @@ public void Dispose()
8487
/// <summary>
8588
/// Asserts that all invoices contain invoice lines.
8689
/// </summary>
87-
[Theory]
90+
[SkippableTheory]
8891
[InlineData("Chinook_Db2")]
8992
public void AllInvoicesMustHaveInvoiceLines(string connectionName)
9093
{
@@ -95,7 +98,7 @@ public void AllInvoicesMustHaveInvoiceLines(string connectionName)
9598
/// <summary>
9699
/// Asserts that invoice total matches sum of invoice lines.
97100
/// </summary>
98-
[Theory]
101+
[SkippableTheory]
99102
[InlineData("Chinook_Db2")]
100103
public void InvoiceTotalMustMatchSumOfInvoiceLines(string connectionName)
101104
{
@@ -112,7 +115,7 @@ public void InvoiceTotalMustMatchSumOfInvoiceLines(string connectionName)
112115
/// <summary>
113116
/// Verifies that the Genre table was populated properly.
114117
/// </summary>
115-
[Theory]
118+
[SkippableTheory]
116119
[InlineData("Chinook_Db2")]
117120
public void GenreTableShouldBePopulated(string connectionName)
118121
{
@@ -123,7 +126,7 @@ public void GenreTableShouldBePopulated(string connectionName)
123126
/// <summary>
124127
/// Verifies that last record of Genre table has the proper information.
125128
/// </summary>
126-
[Theory]
129+
[SkippableTheory]
127130
[InlineData("Chinook_Db2")]
128131
public void GenreLastRecordHasProperInfo(string connectionName)
129132
{
@@ -141,7 +144,7 @@ public void GenreLastRecordHasProperInfo(string connectionName)
141144
/// <summary>
142145
/// Verifies that the MediaType table was populated properly.
143146
/// </summary>
144-
[Theory]
147+
[SkippableTheory]
145148
[InlineData("Chinook_Db2")]
146149
public void MediaTypeTableShouldBePopulated(string connectionName)
147150
{
@@ -152,7 +155,7 @@ public void MediaTypeTableShouldBePopulated(string connectionName)
152155
/// <summary>
153156
/// Verifies that last record of MediaType table has the proper information.
154157
/// </summary>
155-
[Theory]
158+
[SkippableTheory]
156159
[InlineData("Chinook_Db2")]
157160
public void MediaTypeLastRecordHasProperInfo(string connectionName)
158161
{
@@ -170,7 +173,7 @@ public void MediaTypeLastRecordHasProperInfo(string connectionName)
170173
/// <summary>
171174
/// Verifies that the Artist table was populated properly.
172175
/// </summary>
173-
[Theory]
176+
[SkippableTheory]
174177
[InlineData("Chinook_Db2")]
175178
public void ArtistTableShouldBePopulated(string connectionName)
176179
{
@@ -181,7 +184,7 @@ public void ArtistTableShouldBePopulated(string connectionName)
181184
/// <summary>
182185
/// Verifies that last record of Artist table has the proper information.
183186
/// </summary>
184-
[Theory]
187+
[SkippableTheory]
185188
[InlineData("Chinook_Db2")]
186189
public void ArtistLastRecordHasProperInfo(string connectionName)
187190
{
@@ -199,7 +202,7 @@ public void ArtistLastRecordHasProperInfo(string connectionName)
199202
/// <summary>
200203
/// Verifies that the Album table was populated properly.
201204
/// </summary>
202-
[Theory]
205+
[SkippableTheory]
203206
[InlineData("Chinook_Db2")]
204207
public void AlbumTableShouldBePopulated(string connectionName)
205208
{
@@ -210,7 +213,7 @@ public void AlbumTableShouldBePopulated(string connectionName)
210213
/// <summary>
211214
/// Verifies that last record of Album table has the proper information.
212215
/// </summary>
213-
[Theory]
216+
[SkippableTheory]
214217
[InlineData("Chinook_Db2")]
215218
public void AlbumLastRecordHasProperInfo(string connectionName)
216219
{
@@ -229,7 +232,7 @@ public void AlbumLastRecordHasProperInfo(string connectionName)
229232
/// <summary>
230233
/// Verifies that the Track table was populated properly.
231234
/// </summary>
232-
[Theory]
235+
[SkippableTheory]
233236
[InlineData("Chinook_Db2")]
234237
public void TrackTableShouldBePopulated(string connectionName)
235238
{
@@ -240,7 +243,7 @@ public void TrackTableShouldBePopulated(string connectionName)
240243
/// <summary>
241244
/// Verifies that last record of Track table has the proper information.
242245
/// </summary>
243-
[Theory]
246+
[SkippableTheory]
244247
[InlineData("Chinook_Db2")]
245248
public void TrackLastRecordHasProperInfo(string connectionName)
246249
{
@@ -265,7 +268,7 @@ public void TrackLastRecordHasProperInfo(string connectionName)
265268
/// <summary>
266269
/// Verifies that the Employee table was populated properly.
267270
/// </summary>
268-
[Theory]
271+
[SkippableTheory]
269272
[InlineData("Chinook_Db2")]
270273
public void EmployeeTableShouldBePopulated(string connectionName)
271274
{
@@ -276,7 +279,7 @@ public void EmployeeTableShouldBePopulated(string connectionName)
276279
/// <summary>
277280
/// Verifies that last record of Employee table has the proper information.
278281
/// </summary>
279-
[Theory]
282+
[SkippableTheory]
280283
[InlineData("Chinook_Db2")]
281284
public void EmployeeLastRecordHasProperInfo(string connectionName)
282285
{
@@ -307,7 +310,7 @@ public void EmployeeLastRecordHasProperInfo(string connectionName)
307310
/// <summary>
308311
/// Verifies that the Customer table was populated properly.
309312
/// </summary>
310-
[Theory]
313+
[SkippableTheory]
311314
[InlineData("Chinook_Db2")]
312315
public void CustomerTableShouldBePopulated(string connectionName)
313316
{
@@ -318,7 +321,7 @@ public void CustomerTableShouldBePopulated(string connectionName)
318321
/// <summary>
319322
/// Verifies that last record of Customer table has the proper information.
320323
/// </summary>
321-
[Theory]
324+
[SkippableTheory]
322325
[InlineData("Chinook_Db2")]
323326
public void CustomerLastRecordHasProperInfo(string connectionName)
324327
{
@@ -347,7 +350,7 @@ public void CustomerLastRecordHasProperInfo(string connectionName)
347350
/// <summary>
348351
/// Verifies that the Invoice table was populated properly.
349352
/// </summary>
350-
[Theory]
353+
[SkippableTheory]
351354
[InlineData("Chinook_Db2")]
352355
public void InvoiceTableShouldBePopulated(string connectionName)
353356
{
@@ -358,7 +361,7 @@ public void InvoiceTableShouldBePopulated(string connectionName)
358361
/// <summary>
359362
/// Verifies that last record of Invoice table has the proper information.
360363
/// </summary>
361-
[Theory]
364+
[SkippableTheory]
362365
[InlineData("Chinook_Db2")]
363366
public void InvoiceLastRecordHasProperInfo(string connectionName)
364367
{
@@ -383,7 +386,7 @@ public void InvoiceLastRecordHasProperInfo(string connectionName)
383386
/// <summary>
384387
/// Verifies that the InvoiceLine table was populated properly.
385388
/// </summary>
386-
[Theory]
389+
[SkippableTheory]
387390
[InlineData("Chinook_Db2")]
388391
public void InvoiceLineTableShouldBePopulated(string connectionName)
389392
{
@@ -394,7 +397,7 @@ public void InvoiceLineTableShouldBePopulated(string connectionName)
394397
/// <summary>
395398
/// Verifies that last record of InvoiceLine table has the proper information.
396399
/// </summary>
397-
[Theory]
400+
[SkippableTheory]
398401
[InlineData("Chinook_Db2")]
399402
public void InvoiceLineLastRecordHasProperInfo(string connectionName)
400403
{
@@ -415,7 +418,7 @@ public void InvoiceLineLastRecordHasProperInfo(string connectionName)
415418
/// <summary>
416419
/// Verifies that the Playlist table was populated properly.
417420
/// </summary>
418-
[Theory]
421+
[SkippableTheory]
419422
[InlineData("Chinook_Db2")]
420423
public void PlaylistTableShouldBePopulated(string connectionName)
421424
{
@@ -426,7 +429,7 @@ public void PlaylistTableShouldBePopulated(string connectionName)
426429
/// <summary>
427430
/// Verifies that last record of Playlist table has the proper information.
428431
/// </summary>
429-
[Theory]
432+
[SkippableTheory]
430433
[InlineData("Chinook_Db2")]
431434
public void PlaylistLastRecordHasProperInfo(string connectionName)
432435
{
@@ -444,7 +447,7 @@ public void PlaylistLastRecordHasProperInfo(string connectionName)
444447
/// <summary>
445448
/// Verifies that the PlaylistTrack table was populated properly.
446449
/// </summary>
447-
[Theory]
450+
[SkippableTheory]
448451
[InlineData("Chinook_Db2")]
449452
public void PlaylistTrackTableShouldBePopulated(string connectionName)
450453
{
@@ -455,7 +458,7 @@ public void PlaylistTrackTableShouldBePopulated(string connectionName)
455458
/// <summary>
456459
/// Verifies that last record of PlaylistTrack table has the proper information.
457460
/// </summary>
458-
[Theory]
461+
[SkippableTheory]
459462
[InlineData("Chinook_Db2")]
460463
public void PlaylistTrackLastRecordHasProperInfo(string connectionName)
461464
{
@@ -473,7 +476,7 @@ public void PlaylistTrackLastRecordHasProperInfo(string connectionName)
473476
/// <summary>
474477
/// Verifies that the Unicode characters are populated properly.
475478
/// </summary>
476-
[Theory]
479+
[SkippableTheory]
477480
[InlineData("Chinook_Db2")]
478481
public void CustomerId01HasProperUnicodeCharacters(string connectionName)
479482
{
@@ -499,7 +502,7 @@ public void CustomerId01HasProperUnicodeCharacters(string connectionName)
499502
/// <summary>
500503
/// Verifies that the Unicode characters are populated properly.
501504
/// </summary>
502-
[Theory]
505+
[SkippableTheory]
503506
[InlineData("Chinook_Db2")]
504507
public void CustomerId02HasProperUnicodeCharacters(string connectionName)
505508
{
@@ -525,7 +528,7 @@ public void CustomerId02HasProperUnicodeCharacters(string connectionName)
525528
/// <summary>
526529
/// Verifies that the Unicode characters are populated properly.
527530
/// </summary>
528-
[Theory]
531+
[SkippableTheory]
529532
[InlineData("Chinook_Db2")]
530533
public void CustomerId03HasProperUnicodeCharacters(string connectionName)
531534
{
@@ -551,7 +554,7 @@ public void CustomerId03HasProperUnicodeCharacters(string connectionName)
551554
/// <summary>
552555
/// Verifies that the Unicode characters are populated properly.
553556
/// </summary>
554-
[Theory]
557+
[SkippableTheory]
555558
[InlineData("Chinook_Db2")]
556559
public void CustomerId04HasProperUnicodeCharacters(string connectionName)
557560
{
@@ -577,7 +580,7 @@ public void CustomerId04HasProperUnicodeCharacters(string connectionName)
577580
/// <summary>
578581
/// Verifies that the Unicode characters are populated properly.
579582
/// </summary>
580-
[Theory]
583+
[SkippableTheory]
581584
[InlineData("Chinook_Db2")]
582585
public void CustomerId05HasProperUnicodeCharacters(string connectionName)
583586
{
@@ -603,7 +606,7 @@ public void CustomerId05HasProperUnicodeCharacters(string connectionName)
603606
/// <summary>
604607
/// Verifies that the Unicode characters are populated properly.
605608
/// </summary>
606-
[Theory]
609+
[SkippableTheory]
607610
[InlineData("Chinook_Db2")]
608611
public void CustomerId06HasProperUnicodeCharacters(string connectionName)
609612
{
@@ -629,7 +632,7 @@ public void CustomerId06HasProperUnicodeCharacters(string connectionName)
629632
/// <summary>
630633
/// Verifies that the Unicode characters are populated properly.
631634
/// </summary>
632-
[Theory]
635+
[SkippableTheory]
633636
[InlineData("Chinook_Db2")]
634637
public void CustomerId07HasProperUnicodeCharacters(string connectionName)
635638
{
@@ -655,7 +658,7 @@ public void CustomerId07HasProperUnicodeCharacters(string connectionName)
655658
/// <summary>
656659
/// Verifies that the Unicode characters are populated properly.
657660
/// </summary>
658-
[Theory]
661+
[SkippableTheory]
659662
[InlineData("Chinook_Db2")]
660663
public void CustomerId08HasProperUnicodeCharacters(string connectionName)
661664
{
@@ -681,7 +684,7 @@ public void CustomerId08HasProperUnicodeCharacters(string connectionName)
681684
/// <summary>
682685
/// Verifies that the Unicode characters are populated properly.
683686
/// </summary>
684-
[Theory]
687+
[SkippableTheory]
685688
[InlineData("Chinook_Db2")]
686689
public void CustomerId09HasProperUnicodeCharacters(string connectionName)
687690
{
@@ -707,7 +710,7 @@ public void CustomerId09HasProperUnicodeCharacters(string connectionName)
707710
/// <summary>
708711
/// Verifies that the Unicode characters are populated properly.
709712
/// </summary>
710-
[Theory]
713+
[SkippableTheory]
711714
[InlineData("Chinook_Db2")]
712715
public void CustomerId10HasProperUnicodeCharacters(string connectionName)
713716
{
@@ -733,7 +736,7 @@ public void CustomerId10HasProperUnicodeCharacters(string connectionName)
733736
/// <summary>
734737
/// Verifies that the Unicode characters are populated properly.
735738
/// </summary>
736-
[Theory]
739+
[SkippableTheory]
737740
[InlineData("Chinook_Db2")]
738741
public void CustomerId11HasProperUnicodeCharacters(string connectionName)
739742
{

0 commit comments

Comments
 (0)