Skip to content

Commit

Permalink
(#481) Test: extract the shared API tests to a separate project
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Jun 8, 2024
1 parent 7674caa commit d5d86b7
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</PropertyGroup>

<ItemGroup Label="Packaging">
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" Visible="false" />
</ItemGroup>

<PropertyGroup Condition=" '$(MSBuildProjectExtension)' == '.csproj' ">
Expand Down
11 changes: 9 additions & 2 deletions XamlMath.All.sln
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,13 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfMath.ApiTest", "src\WpfMath.ApiTest\WpfMath.ApiTest.csproj", "{3FC6007E-5400-42FB-AD7A-727ADFAB6469}"
ProjectSection(ProjectDependencies) = postProject
{010A34F1-1F3E-4528-99B4-95054DD45729} = {010A34F1-1F3E-4528-99B4-95054DD45729}
{C9B5E02E-04FB-405F-9BEB-6CF4736939EB} = {C9B5E02E-04FB-405F-9BEB-6CF4736939EB}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlMath.ApiTest.Framework", "src\XamlMath.ApiTest.Framework\XamlMath.ApiTest.Framework.csproj", "{204E2BD3-05C6-41E0-998F-0E0AC1530DCC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaMath.ApiTest", "src\AvaloniaMath.ApiTest\AvaloniaMath.ApiTest.csproj", "{54F77EF7-F918-46F8-A615-56BC0BFE8AAB}"
ProjectSection(ProjectDependencies) = postProject
{945C8E20-AE99-493E-8A0D-D5880272050B} = {945C8E20-AE99-493E-8A0D-D5880272050B}
{C9B5E02E-04FB-405F-9BEB-6CF4736939EB} = {C9B5E02E-04FB-405F-9BEB-6CF4736939EB}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "api", "api", "{3F2FED19-93A5-440C-B036-FE4A2FBCC49A}"
Expand Down Expand Up @@ -97,6 +95,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "fonts", "fonts", "{766B0CFB
fonts\LICENSES.md = fonts\LICENSES.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlMath.Shared.ApiTest", "src\XamlMath.Shared.ApiTest\XamlMath.Shared.ApiTest.csproj", "{61B897BB-B64C-4E63-8FD4-F083A22EF58C}"
ProjectSection(ProjectDependencies) = postProject
{C9B5E02E-04FB-405F-9BEB-6CF4736939EB} = {C9B5E02E-04FB-405F-9BEB-6CF4736939EB}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -143,6 +146,10 @@ Global
{A29B12C8-9AE6-4016-9AB8-702B67409C95}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A29B12C8-9AE6-4016-9AB8-702B67409C95}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A29B12C8-9AE6-4016-9AB8-702B67409C95}.Release|Any CPU.Build.0 = Release|Any CPU
{61B897BB-B64C-4E63-8FD4-F083A22EF58C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{61B897BB-B64C-4E63-8FD4-F083A22EF58C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61B897BB-B64C-4E63-8FD4-F083A22EF58C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61B897BB-B64C-4E63-8FD4-F083A22EF58C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion src/AvaloniaMath.ApiTest/ApiDefinitionTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using WpfMath.ApiText.Framework;
using XamlMath.ApiTest.Framework;

namespace AvaloniaMath.ApiTest;

Expand Down
3 changes: 0 additions & 3 deletions src/AvaloniaMath.ApiTest/AvaloniaMath.ApiTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
<InputAssembly Include="../AvaloniaMath/bin/$(Configuration)/net462/AvaloniaMath.dll" Framework="net462" />
<InputAssembly Include="../AvaloniaMath/bin/$(Configuration)/netstandard2.0/AvaloniaMath.dll" Framework="netstandard2.0" />
<InputAssembly Include="../AvaloniaMath/bin/$(Configuration)/net6.0/AvaloniaMath.dll" Framework="net6.0" />
<InputAssembly Include="../XamlMath.Shared/bin/$(Configuration)/net462/XamlMath.Shared.dll" Framework="net462" />
<InputAssembly Include="../XamlMath.Shared/bin/$(Configuration)/netstandard2.0/XamlMath.Shared.dll" Framework="netstandard2.0" />
<InputAssembly Include="../XamlMath.Shared/bin/$(Configuration)/net6.0/XamlMath.Shared.dll" Framework="net6.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/WpfMath.ApiTest/ApiDefinitionTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using WpfMath.ApiText.Framework;
using XamlMath.ApiTest.Framework;

namespace WpfMath.ApiTest;

Expand Down
3 changes: 0 additions & 3 deletions src/WpfMath.ApiTest/WpfMath.ApiTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
<ItemGroup>
<InputAssembly Include="../WpfMath/bin/$(Configuration)/net462/WpfMath.dll" Framework="net462" />
<InputAssembly Include="../WpfMath/bin/$(Configuration)/net6.0-windows/WpfMath.dll" Framework="net6.0" />
<InputAssembly Include="../XamlMath.Shared/bin/$(Configuration)/net462/XamlMath.Shared.dll" Framework="net462" />
<InputAssembly Include="../XamlMath.Shared/bin/$(Configuration)/netstandard2.0/XamlMath.Shared.dll" Framework="netstandard2.0" />
<InputAssembly Include="../XamlMath.Shared/bin/$(Configuration)/net6.0/XamlMath.Shared.dll" Framework="net6.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/XamlMath.ApiTest.Framework/ApiDefinitionsTestBase.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Reflection;
using DiffEngine;

namespace WpfMath.ApiText.Framework;
namespace XamlMath.ApiTest.Framework;

[UsesVerify]
public class ApiDefinitionTestsBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>WpfMath.ApiText.Framework</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Verify.Xunit" />
</ItemGroup>
Expand Down
14 changes: 14 additions & 0 deletions src/XamlMath.Shared.ApiTest/ApiDefinitionTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using XamlMath.ApiTest.Framework;

namespace WpfMath.ApiTest;

public class ApiDefinitionTests : ApiDefinitionTestsBase
{
[Theory]
[InlineData("XamlMath.Shared.net462.cs")]
[InlineData("XamlMath.Shared.netstandard2.0.cs")]
[InlineData("XamlMath.Shared.net6.0.cs")]
public Task WpfMathShared(string fileName) => DoTest(fileName);

private static Task DoTest(string fileName) => DoTest("XamlMath.Shared.ApiTest.csproj", fileName);
}
1 change: 1 addition & 0 deletions src/XamlMath.Shared.ApiTest/Usings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global using Xunit;
41 changes: 41 additions & 0 deletions src/XamlMath.Shared.ApiTest/XamlMath.Shared.ApiTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.GenAPI" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Verify.Xunit" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<InputAssembly Include="../XamlMath.Shared/bin/$(Configuration)/net462/XamlMath.Shared.dll" Framework="net462" />
<InputAssembly Include="../XamlMath.Shared/bin/$(Configuration)/netstandard2.0/XamlMath.Shared.dll" Framework="netstandard2.0" />
<InputAssembly Include="../XamlMath.Shared/bin/$(Configuration)/net6.0/XamlMath.Shared.dll" Framework="net6.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\src\XamlMath.ApiTest.Framework\XamlMath.ApiTest.Framework.csproj" />
<ProjectReference Include="..\XamlMath.ApiTest.Framework\XamlMath.ApiTest.Framework.csproj" />
</ItemGroup>

<Target Name="_GenerateApiListing" AfterTargets="CoreBuild" Inputs="@(InputAssembly->'%(FullPath)');..\..\api\ExludedAttributes.txt" Outputs="$(MSBuildProjectDirectory)\..\..\api\%(InputAssembly.FileName).%(InputAssembly.Framework).tmp.cs">
<Microsoft.DotNet.GenAPI.GenAPITask Assembly="@(InputAssembly->'%(FullPath)')" OutputPath="$(MSBuildProjectDirectory)\..\..\api\%(InputAssembly.FileName).%(InputAssembly.Framework).tmp.cs" ExcludeAttributesList="..\..\api\ExcludedAttributes.txt" />
</Target>

</Project>

0 comments on commit d5d86b7

Please sign in to comment.