Skip to content

Commit 0f963d4

Browse files
Fix broken test projects by adding needed external dependencies
* Mark as test projects and include test adapter * Add .config file and DependencyModel package if needed * Add AssemblyInfoForTests.cs link if needed * Also fix issues caused by a stricter compiler in net48
1 parent 8476c6e commit 0f963d4

57 files changed

Lines changed: 387 additions & 102 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Lib/src/ScrChecks/ScrChecksTests/ScrChecksTests.csproj

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,48 @@
44
<RootNamespace>SILUBS.ScriptureChecks</RootNamespace>
55
<TargetFramework>net48</TargetFramework>
66
<OutputType>Library</OutputType>
7+
<IsTestProject>true</IsTestProject>
78
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
89
<NoWarn>168,169,219,414,649,1635,1702,1701</NoWarn>
10+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
911
</PropertyGroup>
10-
1112
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
1213
<DebugSymbols>true</DebugSymbols>
1314
<DebugType>full</DebugType>
1415
<Optimize>false</Optimize>
1516
<DefineConstants>DEBUG;TRACE</DefineConstants>
1617
</PropertyGroup>
17-
1818
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
1919
<DebugType>pdbonly</DebugType>
2020
<Optimize>true</Optimize>
2121
<DefineConstants>TRACE</DefineConstants>
2222
</PropertyGroup>
23-
2423
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
2524
<DebugSymbols>true</DebugSymbols>
2625
<DebugType>full</DebugType>
2726
<Optimize>false</Optimize>
2827
<DefineConstants>DEBUG;TRACE</DefineConstants>
2928
</PropertyGroup>
30-
3129
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
3230
<DebugType>pdbonly</DebugType>
3331
<Optimize>true</Optimize>
3432
<DefineConstants>TRACE</DefineConstants>
3533
</PropertyGroup>
36-
3734
<ItemGroup>
35+
<PackageReference Include="NUnit" Version="4.4.0" />
36+
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
37+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
38+
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.0" />
3839
<PackageReference Include="SIL.LCModel.Core" Version="11.0.0-*" />
3940
<PackageReference Include="SIL.LCModel.Core.Tests" Version="11.0.0-*" PrivateAssets="All" />
4041
<PackageReference Include="SIL.LCModel.Utils" Version="11.0.0-*" />
4142
</ItemGroup>
42-
4343
<ItemGroup>
4444
<Reference Include="netstandard" />
4545
</ItemGroup>
46-
4746
<ItemGroup>
4847
<ProjectReference Include="../../../../Src/Common/FwUtils/FwUtils.csproj" />
48+
<ProjectReference Include="../../../../Src/Common/ScriptureUtils/ScriptureUtils.csproj" />
4949
<ProjectReference Include="../ScrChecks.csproj" />
5050
</ItemGroup>
51-
5251
</Project>

Src/AppForTests.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ Comment out the following section when the ParatextData and FieldWorks versions
6868
<!-- Until Chorus starts using libpalaso 13.0.0.0 -->
6969
<bindingRedirect oldVersion="0.0.0.0-17.0.0.0" newVersion="17.0.0.0" />
7070
</dependentAssembly>
71+
<dependentAssembly>
72+
<assemblyIdentity name="Microsoft.Extensions.DependencyModel"
73+
publicKeyToken="adb9793829ddae60"
74+
culture="neutral" />
75+
<bindingRedirect oldVersion="0.0.0.0-99.99.99.99" newVersion="8.0.0.0" />
76+
</dependentAssembly>
7177
</assemblyBinding>
7278
</runtime>
7379
</configuration>
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version='1.0' encoding='utf-8'?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<AssemblyName>CacheLightTests</AssemblyName>
@@ -7,52 +7,46 @@
77
<OutputType>Library</OutputType>
88
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
99
<NoWarn>168,169,219,414,649,1635,1702,1701</NoWarn>
10+
<IsTestProject>true</IsTestProject>
11+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1012
</PropertyGroup>
11-
1213
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
1314
<DefineConstants>DEBUG;TRACE</DefineConstants>
1415
<DebugSymbols>true</DebugSymbols>
1516
<Optimize>false</Optimize>
1617
<DebugType>full</DebugType>
1718
</PropertyGroup>
18-
1919
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
2020
<DefineConstants>TRACE</DefineConstants>
2121
<DebugSymbols>false</DebugSymbols>
2222
<Optimize>true</Optimize>
2323
<DebugType>none</DebugType>
2424
</PropertyGroup>
25-
2625
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
2726
<DefineConstants>DEBUG;TRACE</DefineConstants>
2827
<DebugSymbols>true</DebugSymbols>
2928
<Optimize>false</Optimize>
3029
<DebugType>full</DebugType>
3130
</PropertyGroup>
32-
3331
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
3432
<DefineConstants>TRACE</DefineConstants>
3533
<DebugSymbols>false</DebugSymbols>
3634
<Optimize>true</Optimize>
3735
<DebugType>none</DebugType>
3836
</PropertyGroup>
39-
4037
<ItemGroup>
4138
<PackageReference Include="SIL.LCModel.Core" Version="11.0.0-*" />
4239
<PackageReference Include="SIL.LCModel.Core.Tests" Version="11.0.0-*" PrivateAssets="All" />
4340
<PackageReference Include="SIL.LCModel.Utils" Version="11.0.0-*" />
4441
<PackageReference Include="SIL.LCModel.Utils.Tests" Version="11.0.0-*" PrivateAssets="All" />
4542
<PackageReference Include="SIL.TestUtilities" Version="17.0.0-*" />
4643
</ItemGroup>
47-
4844
<ItemGroup>
4945
<Reference Include="netstandard" />
5046
</ItemGroup>
51-
5247
<ItemGroup>
5348
<ProjectReference Include="../../Common/FwUtils/FwUtilsTests/FwUtilsTests.csproj" />
5449
<ProjectReference Include="../../Common/ViewsInterfaces/ViewsInterfaces.csproj" />
5550
<ProjectReference Include="../CacheLight.csproj" />
5651
</ItemGroup>
57-
5852
</Project>

Src/Common/Controls/DetailControls/DetailControlsTests/DetailControlsTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<RootNamespace>SIL.FieldWorks.Common.Framework.DetailControls</RootNamespace>
66
<TargetFramework>net48</TargetFramework>
77
<OutputType>Library</OutputType>
8+
<IsTestProject>true</IsTestProject>
89
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
910
<NoWarn>168,169,219,414,649,1635,1702,1701</NoWarn>
1011
</PropertyGroup>

Src/Common/Controls/FwControls/FwControlsTests/FwControlsTests.csproj

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
<RootNamespace>SIL.FieldWorks.Common.Controls</RootNamespace>
66
<TargetFramework>net48</TargetFramework>
77
<OutputType>Library</OutputType>
8+
<IsTestProject>true</IsTestProject>
89
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
910
<NoWarn>168,169,219,414,649,1635,1702,1701</NoWarn>
11+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
12+
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
1013
</PropertyGroup>
1114

1215
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@@ -44,7 +47,7 @@
4447
<PackageReference Include="SIL.LCModel.Utils" Version="11.0.0-*" />
4548
<PackageReference Include="SIL.LCModel.Utils.Tests" Version="11.0.0-*" PrivateAssets="All" />
4649
<PackageReference Include="SIL.TestUtilities" Version="17.0.0-*" />
47-
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
50+
<PackageReference Include="System.Resources.Extensions" Version="6.0.0" />
4851
</ItemGroup>
4952

5053
<ItemGroup>
@@ -60,4 +63,8 @@
6063
<ProjectReference Include="../FwControls.csproj" />
6164
</ItemGroup>
6265

66+
<ItemGroup>
67+
<Compile Include="../../../../AssemblyInfoForTests.cs" Link="Properties/AssemblyInfoForTests.cs" />
68+
</ItemGroup>
69+
6370
</Project>

Src/Common/Controls/Widgets/WidgetsTests/WidgetsTests.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
<RootNamespace>SIL.FieldWorks.Common.Widgets</RootNamespace>
66
<TargetFramework>net48</TargetFramework>
77
<OutputType>Library</OutputType>
8+
<IsTestProject>true</IsTestProject>
89
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
910
<NoWarn>168,169,219,414,649,1635,1702,1701</NoWarn>
11+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1012
</PropertyGroup>
1113

1214
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@@ -66,4 +68,8 @@
6668
<ProjectReference Include="../Widgets.csproj" />
6769
</ItemGroup>
6870

71+
<ItemGroup>
72+
<Compile Include="../../../../AssemblyInfoForTests.cs" Link="Properties/AssemblyInfoForTests.cs" />
73+
</ItemGroup>
74+
6975
</Project>

Src/Common/Controls/XMLViews/XMLViewsTests/XMLViewsTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<OutputType>Library</OutputType>
88
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
99
<NoWarn>168,169,219,414,649,1635,1702,1701</NoWarn>
10+
<IsTestProject>true</IsTestProject>
1011
</PropertyGroup>
1112

1213
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">

Src/Common/Controls/XMLViews/XMLViewsTests/XmlBrowseViewBaseVcTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void GetHeaderLabels_ReturnsColumnSpecLabels()
176176

177177
var columnLabels = XmlBrowseViewBaseVc.GetHeaderLabels(testVc);
178178

179-
CollectionAssert.That("Occurrence" }, Is.EqualTo(new List<string> { "Ref"), columnLabels);
179+
CollectionAssert.AreEqual(new List<string> { "Ref", "Occurrence" }, columnLabels);
180180
}
181181
}
182182
}

Src/Common/FieldWorks/FieldWorksTests/FieldWorksTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<OutputType>Library</OutputType>
88
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
99
<NoWarn>168,169,219,414,649,1635,1702,1701</NoWarn>
10+
<IsTestProject>true</IsTestProject>
1011
</PropertyGroup>
1112

1213
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">

Src/Common/Filters/FiltersTests/FiltersTests.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
<RootNamespace>SIL.FieldWorks.Filters</RootNamespace>
66
<TargetFramework>net48</TargetFramework>
77
<OutputType>Library</OutputType>
8+
<IsTestProject>true</IsTestProject>
89
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
910
<NoWarn>168,169,219,414,649,1635,1702,1701</NoWarn>
11+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1012
</PropertyGroup>
1113

1214
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@@ -62,4 +64,8 @@
6264
<ProjectReference Include="../Filters.csproj" />
6365
</ItemGroup>
6466

67+
<ItemGroup>
68+
<Compile Include="../../../AssemblyInfoForTests.cs" Link="Properties/AssemblyInfoForTests.cs" />
69+
</ItemGroup>
70+
6571
</Project>

0 commit comments

Comments
 (0)