Skip to content

Commit 51d6421

Browse files
authored
[Infra] Split bcl test project to handle references. (#169)
1 parent 6806a1f commit 51d6421

27 files changed

+729
-143
lines changed

Build/BCLTests.props

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project>
2+
<PropertyGroup>
3+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
4+
<RootNamespace>StructLinq.BCL.Tests</RootNamespace>
5+
<IsPackable>False</IsPackable>
6+
</PropertyGroup>
7+
8+
<PropertyGroup Condition="$(MSBuildProjectName.Contains('x86'))">
9+
<Platform>x86</Platform>
10+
<Platforms>x86</Platforms>
11+
<RunSettingsFilePath>$(RootDir)\Build\x86.runsettings</RunSettingsFilePath>
12+
<DefineConstants>IS_X86</DefineConstants>
13+
</PropertyGroup>
14+
15+
<PropertyGroup Condition="$(MSBuildProjectName.Contains('x64'))">
16+
<Platform>x64</Platform>
17+
<Platforms>x64</Platforms>
18+
<RunSettingsFilePath>$(RootDir)\Build\x64.runsettings</RunSettingsFilePath>
19+
<DefineConstants>IS_X64</DefineConstants>
20+
</PropertyGroup>
21+
22+
</Project>

StructLinq.sln

Lines changed: 251 additions & 30 deletions
Large diffs are not rendered by default.

src/Directory.Build.props

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,8 @@
44
</PropertyGroup>
55
<Import Project="$(RootDir)\Build\Common.props"/>
66

7-
<!-- common tests properties -->
8-
<PropertyGroup Condition="$(MSBuildProjectName.EndsWith('Tests'))">
9-
<IsPackable>False</IsPackable>
10-
<DefaultTargetFrameworks>net70;net60;net48</DefaultTargetFrameworks>
11-
</PropertyGroup>
12-
13-
<ItemGroup Condition="$(MSBuildProjectName.EndsWith('Tests'))">
14-
<PackageReference Include="FluentAssertions" Version="6.7.0" />
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
16-
<PackageReference Include="xunit" Version="2.4.2" />
17-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
18-
<PrivateAssets>all</PrivateAssets>
19-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
20-
</PackageReference>
21-
</ItemGroup>
22-
237
<Import Project="$(RootDir)\Build\DeleteGenerateBindingRedirects.target" Condition="$(MSBuildProjectName.EndsWith('Tests'))"/>
248

25-
<!-- common benchmark properties -->
26-
<PropertyGroup Condition="$(MSBuildProjectName.EndsWith('Benchmark'))">
27-
<IsPackable>False</IsPackable>
28-
<OutputType>Exe</OutputType>
29-
<DefaultTargetFrameworks>net70;net60;net48</DefaultTargetFrameworks>
30-
</PropertyGroup>
31-
32-
<ItemGroup Condition="$(MSBuildProjectName.EndsWith('Benchmark'))">
33-
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
34-
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.2" />
35-
</ItemGroup>
36-
379
<Import Project="$(RootDir)\Build\DeleteGenerateBindingRedirects.target" Condition="$(MSBuildProjectName.EndsWith('Benchmark'))"/>
3810

3911
</Project>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using Xunit;
3+
4+
namespace StructLinq.BCL.Tests
5+
{
6+
#if IS_X86
7+
public class BitnessTests
8+
{
9+
[Fact]
10+
public void Checkx86Bitness()
11+
{
12+
Assert.Equal(4, IntPtr.Size);
13+
}
14+
}
15+
#endif
16+
17+
#if IS_X64
18+
public class BitnessTests
19+
{
20+
[Fact]
21+
public void Checkx64Bitness()
22+
{
23+
Assert.Equal(8, IntPtr.Size);
24+
}
25+
}
26+
#endif
27+
}

src/StructLinq.BCL.Tests/ListLayoutTests.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -106,25 +106,4 @@ public void ShouldMatchArrayOfString(int size)
106106
}
107107
}
108108

109-
#if IS_X86
110-
public class BitnessTests
111-
{
112-
[Fact]
113-
public void Checkx86Bitness()
114-
{
115-
Assert.Equal(4, IntPtr.Size);
116-
}
117-
}
118-
#endif
119-
120-
#if IS_X64
121-
public class BitnessTests
122-
{
123-
[Fact]
124-
public void Checkx64Bitness()
125-
{
126-
Assert.Equal(8, IntPtr.Size);
127-
}
128-
}
129-
#endif
130109
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<Import Project="$(RootDir)\Build\BCLTests.props" />
4+
5+
<PropertyGroup>
6+
<TargetFramework>netcoreapp2.1</TargetFramework>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="ObjectLayoutInspector" Version="0.1.4" />
11+
<PackageReference Include="FluentAssertions" Version="6.8.0" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
13+
<PackageReference Include="xunit" Version="2.4.2" />
14+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
15+
<PrivateAssets>all</PrivateAssets>
16+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
17+
</PackageReference>
18+
</ItemGroup>
19+
20+
<ItemGroup>
21+
<ProjectReference Include="..\StructLinq\StructLinq.csproj" />
22+
</ItemGroup>
23+
24+
</Project>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<Import Project="$(RootDir)\Build\BCLTests.props" />
4+
5+
<PropertyGroup>
6+
<TargetFramework>netcoreapp2.1</TargetFramework>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="ObjectLayoutInspector" Version="0.1.4" />
11+
<PackageReference Include="FluentAssertions" Version="6.8.0" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
13+
<PackageReference Include="xunit" Version="2.4.2" />
14+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
15+
<PrivateAssets>all</PrivateAssets>
16+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
17+
</PackageReference>
18+
</ItemGroup>
19+
20+
<ItemGroup>
21+
<ProjectReference Include="..\StructLinq\StructLinq.csproj" />
22+
</ItemGroup>
23+
24+
</Project>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<Import Project="$(RootDir)\Build\BCLTests.props" />
4+
5+
<PropertyGroup>
6+
<TargetFramework>netcoreapp3.0</TargetFramework>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="ObjectLayoutInspector" Version="0.1.4" />
11+
<PackageReference Include="FluentAssertions" Version="6.8.0" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
13+
<PackageReference Include="xunit" Version="2.4.2" />
14+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
15+
<PrivateAssets>all</PrivateAssets>
16+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
17+
</PackageReference>
18+
</ItemGroup>
19+
20+
<ItemGroup>
21+
<ProjectReference Include="..\StructLinq\StructLinq.csproj" />
22+
</ItemGroup>
23+
24+
</Project>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<Import Project="$(RootDir)\Build\BCLTests.props" />
4+
5+
<PropertyGroup>
6+
<TargetFramework>netcoreapp3.0</TargetFramework>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="ObjectLayoutInspector" Version="0.1.4" />
11+
<PackageReference Include="FluentAssertions" Version="6.8.0" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
13+
<PackageReference Include="xunit" Version="2.4.2" />
14+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
15+
<PrivateAssets>all</PrivateAssets>
16+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
17+
</PackageReference>
18+
</ItemGroup>
19+
20+
<ItemGroup>
21+
<ProjectReference Include="..\StructLinq\StructLinq.csproj" />
22+
</ItemGroup>
23+
24+
</Project>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<Import Project="$(RootDir)\Build\BCLTests.props" />
4+
5+
<PropertyGroup>
6+
<TargetFramework>netcoreapp3.1</TargetFramework>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="ObjectLayoutInspector" Version="0.1.4" />
11+
<PackageReference Include="FluentAssertions" Version="6.8.0" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
13+
<PackageReference Include="xunit" Version="2.4.2" />
14+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
15+
<PrivateAssets>all</PrivateAssets>
16+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
17+
</PackageReference>
18+
</ItemGroup>
19+
20+
<ItemGroup>
21+
<ProjectReference Include="..\StructLinq\StructLinq.csproj" />
22+
</ItemGroup>
23+
24+
</Project>

0 commit comments

Comments
 (0)