Skip to content

Commit 5de1b5f

Browse files
committed
refactor: consolidate test project settings in Directory.Build.props
1 parent f5db2e2 commit 5de1b5f

File tree

4 files changed

+54
-53
lines changed

4 files changed

+54
-53
lines changed

System.IO.Abstractions.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B66A0B3F-6A0
4545
src\Directory.Build.props = src\Directory.Build.props
4646
EndProjectSection
4747
EndProject
48+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{5971F640-8BBA-4264-BCD6-60A97DD54B4A}"
49+
ProjectSection(SolutionItems) = preProject
50+
tests\Directory.Build.props = tests\Directory.Build.props
51+
EndProjectSection
52+
EndProject
4853
Global
4954
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5055
Debug|Any CPU = Debug|Any CPU
@@ -97,6 +102,7 @@ Global
97102
{D905E09D-6DC3-4F7C-8E83-82FADAE2C9E5} = {2BE9161B-A3F3-4511-81DB-DB1DCB6375C9}
98103
{1B8388D2-58A7-47B8-89EC-C5A94A0FEED5} = {C078E0B6-9747-475F-A999-B9E775DF6643}
99104
{B66A0B3F-6A00-482E-99E2-27D8DECB075E} = {BBF7AD8D-5522-48C0-A906-00CBB72308A0}
105+
{5971F640-8BBA-4264-BCD6-60A97DD54B4A} = {BBF7AD8D-5522-48C0-A906-00CBB72308A0}
100106
EndGlobalSection
101107
GlobalSection(ExtensibilityGlobals) = postSolution
102108
SolutionGuid = {8885C59C-F6A0-4C2F-A3BC-B720E9BD161F}

tests/Directory.Build.props

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<Project>
2+
3+
<Import Project="$(MSBuildThisFileDirectory)/../Directory.Build.props"
4+
Condition="Exists('$(MSBuildThisFileDirectory)/../Directory.Build.props')"/>
5+
6+
<PropertyGroup>
7+
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
8+
<TargetFrameworks Condition="!$([MSBuild]::IsOsUnixLike())">$(TargetFrameworks);net472</TargetFrameworks>
9+
<IsPackable>false</IsPackable>
10+
<IsTestable>true</IsTestable>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="coverlet.collector">
15+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
16+
<PrivateAssets>all</PrivateAssets>
17+
</PackageReference>
18+
<PackageReference Include="GitHubActionsTestLogger" />
19+
<PackageReference Include="Microsoft.NET.Test.Sdk" />
20+
<PackageReference Include="Moq" />
21+
<PackageReference Include="NUnit" />
22+
<PackageReference Include="NUnit.Analyzers">
23+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
24+
<PrivateAssets>all</PrivateAssets>
25+
</PackageReference>
26+
<PackageReference Include="NUnit3TestAdapter" />
27+
</ItemGroup>
28+
29+
<PropertyGroup>
30+
<!--
31+
Allow deprecated binary formatter functionality on .NET 8 so that we can test it
32+
-->
33+
<EnableUnsafeBinaryFormatterSerialization Condition="'$(TargetFramework)' == 'net8.0'">true</EnableUnsafeBinaryFormatterSerialization>
34+
</PropertyGroup>
35+
36+
</Project>
Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,28 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
23
<PropertyGroup>
3-
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
4-
<TargetFrameworks Condition="!$([MSBuild]::IsOsUnixLike())">$(TargetFrameworks);net472</TargetFrameworks>
54
<Description>The unit tests for our pre-built mocks</Description>
65
<AssemblyName>System.IO.Abstractions.TestingHelpers.Tests</AssemblyName>
76
<RootNamespace>System.IO.Abstractions.TestingHelpers.Tests</RootNamespace>
8-
<IsPackable>false</IsPackable>
9-
<IsTestable>true</IsTestable>
107
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="../../src/TestableIO.System.IO.Abstractions.TestingHelpers/TestableIO.System.IO.Abstractions.TestingHelpers.csproj" />
11+
</ItemGroup>
12+
1113
<PropertyGroup>
1214
<!--
1315
Ensure that test logger is copied to output directory, see
1416
https://github.com/Tyrrrz/GitHubActionsTestLogger/issues/5
1517
-->
1618
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
1719
</PropertyGroup>
20+
1821
<ItemGroup>
1922
<None Remove="TestFiles\SecondTestFile.txt" />
2023
<None Remove="TestFiles\TestFile.txt" />
21-
</ItemGroup>
22-
<ItemGroup>
2324
<EmbeddedResource Include="TestFiles\SecondTestFile.txt" />
2425
<EmbeddedResource Include="TestFiles\TestFile.txt" />
2526
</ItemGroup>
26-
<ItemGroup>
27-
<ProjectReference Include="../../src/TestableIO.System.IO.Abstractions.TestingHelpers/TestableIO.System.IO.Abstractions.TestingHelpers.csproj" />
28-
</ItemGroup>
29-
<ItemGroup>
30-
<PackageReference Include="coverlet.collector">
31-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
32-
<PrivateAssets>all</PrivateAssets>
33-
</PackageReference>
34-
<PackageReference Include="GitHubActionsTestLogger" />
35-
<PackageReference Include="Microsoft.NET.Test.Sdk" />
36-
<PackageReference Include="Moq" />
37-
<PackageReference Include="NUnit" />
38-
<PackageReference Include="NUnit.Analyzers">
39-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
40-
<PrivateAssets>all</PrivateAssets>
41-
</PackageReference>
42-
<PackageReference Include="NUnit3TestAdapter" />
43-
</ItemGroup>
44-
<ItemGroup>
45-
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
46-
</ItemGroup>
47-
<PropertyGroup>
48-
<!--
49-
Allow deprecated binary formatter functionality on .NET 8 so that we can test it
50-
-->
51-
<EnableUnsafeBinaryFormatterSerialization Condition="'$(TargetFramework)' == 'net8.0'">true</EnableUnsafeBinaryFormatterSerialization>
52-
</PropertyGroup>
27+
5328
</Project>
Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
23
<PropertyGroup>
3-
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
4-
<TargetFrameworks Condition="!$([MSBuild]::IsOsUnixLike())">$(TargetFrameworks);net472</TargetFrameworks>
54
<Description>The unit tests for our the core abstractions</Description>
65
<AssemblyName>System.IO.Abstractions.Tests</AssemblyName>
76
<RootNamespace>System.IO.Abstractions.Tests</RootNamespace>
8-
<IsPackable>false</IsPackable>
9-
<IsTestable>true</IsTestable>
107
</PropertyGroup>
8+
119
<ItemGroup>
1210
<ProjectReference Include="..\..\src\TestableIO.System.IO.Abstractions.Wrappers\TestableIO.System.IO.Abstractions.Wrappers.csproj" />
1311
</ItemGroup>
12+
1413
<ItemGroup>
15-
<PackageReference Include="coverlet.collector">
16-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
17-
<PrivateAssets>all</PrivateAssets>
18-
</PackageReference>
19-
<PackageReference Include="GitHubActionsTestLogger" />
20-
<PackageReference Include="Microsoft.NET.Test.Sdk" />
21-
<PackageReference Include="Moq" />
22-
<PackageReference Include="NUnit" />
23-
<PackageReference Include="NUnit.Analyzers" />
24-
<PackageReference Include="NUnit3TestAdapter" />
2514
<PackageReference Include="Snapshooter.NUnit" />
2615
</ItemGroup>
27-
<PropertyGroup>
28-
<!--
29-
Allow deprecated binary formatter functionality on .NET 8 so that we can test it
30-
-->
31-
<EnableUnsafeBinaryFormatterSerialization Condition="'$(TargetFramework)' == 'net8.0'">true</EnableUnsafeBinaryFormatterSerialization>
32-
</PropertyGroup>
16+
3317
</Project>

0 commit comments

Comments
 (0)