-
Notifications
You must be signed in to change notification settings - Fork 263
Expand file tree
/
Copy pathApiApprovalTests.cs
More file actions
44 lines (35 loc) · 1.58 KB
/
ApiApprovalTests.cs
File metadata and controls
44 lines (35 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System.Collections.Generic;
namespace TestableIO.System.IO.Abstractions.Api.Tests;
/// <summary>
/// Whenever a test fails, this means that the public API surface changed.
/// If the change was intentional, execute the <see cref="ApiAcceptance.AcceptApiChanges()" /> test to take over the
/// current public API surface. The changes will become part of the pull request and will be reviewed accordingly.
/// </summary>
public sealed class ApiApprovalTests
{
[TestCaseSource(nameof(TargetFrameworksTheoryData))]
public async Task VerifyPublicApiForWrappers(string framework)
{
const string assemblyName = "TestableIO.System.IO.Abstractions.Wrappers";
var publicApi = Helper.CreatePublicApi(framework, assemblyName);
var expectedApi = Helper.GetExpectedApi(framework, assemblyName);
await That(publicApi).IsEqualTo(expectedApi);
}
[TestCaseSource(nameof(TargetFrameworksTheoryData))]
public async Task VerifyPublicApiForTestingHelpers(string framework)
{
const string assemblyName = "TestableIO.System.IO.Abstractions.TestingHelpers";
var publicApi = Helper.CreatePublicApi(framework, assemblyName);
var expectedApi = Helper.GetExpectedApi(framework, assemblyName);
await That(publicApi).IsEqualTo(expectedApi);
}
private static IEnumerable<string> TargetFrameworksTheoryData()
{
List<string> theoryData = new();
foreach (var targetFramework in Helper.GetTargetFrameworks())
{
theoryData.Add(targetFramework);
}
return theoryData;
}
}