Skip to content

Commit 710d034

Browse files
committed
fix test project package reference problems by switching from MSTest.Sdk to Microsoft.NET.Sdk
1 parent 30fc348 commit 710d034

6 files changed

Lines changed: 83 additions & 100 deletions

File tree

BlueM.Opt.sln

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio Version 17
3-
VisualStudioVersion = 17.5.33516.290
2+
# Visual Studio Version 18
3+
VisualStudioVersion = 18.6.11806.211 stable
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BlueM.Opt.Algos", "BlueM.Opt.Algos", "{44D440EE-4641-44A1-B177-2DD0FDD6FB75}"
66
EndProject
@@ -36,7 +36,7 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SensiPlot_ParameterSampling
3636
EndProject
3737
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BlueM.Opt.Tests", "BlueM.Opt.Tests", "{2846C8D3-E679-4D5C-95B4-4CF3E4BF7122}"
3838
EndProject
39-
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "BlueM.Opt.Tests", "BlueM.Opt\Tests\BlueM.Opt.Tests\BlueM.Opt.Tests.vbproj", "{69B4CC2F-9BBB-DE40-7F29-C0F416AF0222}"
39+
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "BlueM.Opt.Tests", "BlueM.Opt\Tests\BlueM.Opt.Tests\BlueM.Opt.Tests.vbproj", "{BBDDC177-F059-4139-9A0E-C4B7D03F2786}"
4040
EndProject
4141
Global
4242
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -164,11 +164,11 @@ Global
164164
{2BC34399-890A-4C37-85A4-3F8D633835B9}.Debug|x86.Build.0 = Debug|x86
165165
{2BC34399-890A-4C37-85A4-3F8D633835B9}.Release|x64.ActiveCfg = Release|x64
166166
{2BC34399-890A-4C37-85A4-3F8D633835B9}.Release|x86.ActiveCfg = Release|x86
167-
{69B4CC2F-9BBB-DE40-7F29-C0F416AF0222}.Debug|x64.ActiveCfg = Debug|x64
168-
{69B4CC2F-9BBB-DE40-7F29-C0F416AF0222}.Debug|x64.Build.0 = Debug|x64
169-
{69B4CC2F-9BBB-DE40-7F29-C0F416AF0222}.Debug|x86.ActiveCfg = Debug|x64
170-
{69B4CC2F-9BBB-DE40-7F29-C0F416AF0222}.Release|x64.ActiveCfg = Release|x64
171-
{69B4CC2F-9BBB-DE40-7F29-C0F416AF0222}.Release|x86.ActiveCfg = Release|x64
167+
{BBDDC177-F059-4139-9A0E-C4B7D03F2786}.Debug|x64.ActiveCfg = Debug|x64
168+
{BBDDC177-F059-4139-9A0E-C4B7D03F2786}.Debug|x64.Build.0 = Debug|x64
169+
{BBDDC177-F059-4139-9A0E-C4B7D03F2786}.Debug|x86.ActiveCfg = Debug|x86
170+
{BBDDC177-F059-4139-9A0E-C4B7D03F2786}.Release|x64.ActiveCfg = Release|x64
171+
{BBDDC177-F059-4139-9A0E-C4B7D03F2786}.Release|x86.ActiveCfg = Release|x86
172172
EndGlobalSection
173173
GlobalSection(SolutionProperties) = preSolution
174174
HideSolutionNode = FALSE
@@ -182,7 +182,7 @@ Global
182182
{A9272445-616D-4B4F-ACFF-DE6F5591AF63} = {44D440EE-4641-44A1-B177-2DD0FDD6FB75}
183183
{6FCD5583-4A2A-4298-8A48-D46FAEFC5D7C} = {44D440EE-4641-44A1-B177-2DD0FDD6FB75}
184184
{2BC34399-890A-4C37-85A4-3F8D633835B9} = {2846C8D3-E679-4D5C-95B4-4CF3E4BF7122}
185-
{69B4CC2F-9BBB-DE40-7F29-C0F416AF0222} = {2846C8D3-E679-4D5C-95B4-4CF3E4BF7122}
185+
{BBDDC177-F059-4139-9A0E-C4B7D03F2786} = {2846C8D3-E679-4D5C-95B4-4CF3E4BF7122}
186186
EndGlobalSection
187187
GlobalSection(ExtensibilityGlobals) = postSolution
188188
SolutionGuid = {4558EFAB-BB97-40C0-BF67-4380356C931B}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RunSettings>
3+
<!-- Configurations that affect the Test Framework -->
4+
<RunConfiguration>
5+
<!-- Use 0 for maximum process-level parallelization. This does not force parallelization within the test DLL (on the thread-level). You can also change it from the Test menu; choose "Run tests in parallel". Unchecked = 1 (only 1), checked = 0 (max). -->
6+
<MaxCpuCount>0</MaxCpuCount>
7+
<!-- Path relative to directory that contains .runsettings file-->
8+
<ResultsDirectory>.\TestResults</ResultsDirectory>
9+
10+
<!-- Omit the whole tag for auto-detection. -->
11+
<!-- [x86] or x64, ARM, ARM64, s390x -->
12+
<!-- You can also change it from the Test menu; choose "Processor Architecture for AnyCPU Projects" -->
13+
<TargetPlatform>x64</TargetPlatform>
14+
15+
<!-- Any TargetFramework moniker or omit the whole tag for auto-detection. -->
16+
<!-- net48, [net40], net6.0, net5.0, netcoreapp3.1, uap10.0 etc. -->
17+
<TargetFrameworkVersion>net48</TargetFrameworkVersion>
18+
19+
</RunConfiguration>
20+
21+
<!-- Configuration for loggers -->
22+
<LoggerRunSettings>
23+
<Loggers>
24+
<Logger friendlyName="console" enabled="True">
25+
<Configuration>
26+
<Verbosity>quiet</Verbosity>
27+
</Configuration>
28+
</Logger>
29+
<Logger friendlyName="trx" enabled="True">
30+
<Configuration>
31+
<LogFileName>test-results.trx</LogFileName>
32+
</Configuration>
33+
</Logger>
34+
<Logger friendlyName="html" enabled="True">
35+
<Configuration>
36+
<LogFileName>test-results.html</LogFileName>
37+
</Configuration>
38+
</Logger>
39+
<Logger friendlyName="blame" enabled="True" />
40+
</Loggers>
41+
</LoggerRunSettings>
42+
43+
<!-- Adapter Specific sections -->
44+
45+
<!-- MSTest adapter -->
46+
<MSTest>
47+
<MapInconclusiveToFailed>True</MapInconclusiveToFailed>
48+
<CaptureTraceOutput>false</CaptureTraceOutput>
49+
<DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>
50+
<DeploymentEnabled>False</DeploymentEnabled>
51+
<AssemblyResolution>
52+
<Directory path="bin\Debug\x64" includeSubDirectories="false"/>
53+
</AssemblyResolution>
54+
</MSTest>
55+
56+
</RunSettings>
Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
1-
<Project Sdk="MSTest.Sdk/3.6.4">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net48</TargetFramework>
55
<LangVersion>latest</LangVersion>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
8-
<!--
9-
Displays error on console in addition to the log file. Note that this feature comes with a performance impact.
10-
For more information, visit https://learn.microsoft.com/dotnet/core/testing/unit-testing-platform-integration-dotnet-test#show-failure-per-test
11-
-->
12-
<TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
13-
<Platforms>x64</Platforms>
8+
<EnableMSTestRunner>true</EnableMSTestRunner>
9+
<OutputType>Exe</OutputType>
10+
<Platforms>x64;x86</Platforms>
1411
</PropertyGroup>
1512

1613
<ItemGroup>
17-
<Compile Remove="Test1.vb" />
14+
<PackageReference Include="MSTest" Version="4.2.3" />
1815
</ItemGroup>
1916

2017
<ItemGroup>
@@ -23,30 +20,7 @@
2320
</ItemGroup>
2421

2522
<ItemGroup>
26-
<PackageReference Update="MSTest.Analyzers" Version="4.2.3">
27-
<PrivateAssets>all</PrivateAssets>
28-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
29-
</PackageReference>
30-
</ItemGroup>
31-
32-
<ItemGroup>
33-
<PackageReference Update="MSTest.TestAdapter" Version="4.2.3" />
34-
</ItemGroup>
35-
36-
<ItemGroup>
37-
<PackageReference Update="MSTest.TestFramework" Version="4.2.3" />
38-
</ItemGroup>
39-
40-
<ItemGroup>
41-
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="18.5.1" />
42-
</ItemGroup>
43-
44-
<ItemGroup>
45-
<PackageReference Update="Microsoft.Testing.Extensions.CodeCoverage" Version="18.6.2" />
46-
</ItemGroup>
47-
48-
<ItemGroup>
49-
<PackageReference Update="Microsoft.Testing.Extensions.TrxReport" Version="2.2.3" />
23+
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
5024
</ItemGroup>
5125

5226
</Project>

BlueM.Opt/Tests/BlueM.Opt.Tests/MSTestSettings.vb

Lines changed: 0 additions & 3 deletions
This file was deleted.

BlueM.Opt/Tests/BlueM.Opt.Tests/TestObjectiveFunctions.vb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,19 +164,27 @@ Public Class TestObjectiveFunctions
164164
End Sub
165165

166166
<TestMethod>
167-
<ExpectedException(GetType(Exception))>
168167
Public Sub CompareSeries_DifferentLength_ThrowsException()
169168
Dim sim As TimeSeries = CreateTimeSeries({1.0, 2.0})
170169
Dim ref As TimeSeries = CreateTimeSeries({1.0, 2.0, 3.0})
171-
ObjectiveFunction.compareSeries(sim, ref, "SSE")
170+
Try
171+
ObjectiveFunction.compareSeries(sim, ref, "SSE")
172+
Assert.Fail("Expected exception for different length series was not thrown.")
173+
Catch ex As Exception
174+
'Expected exception, test passes
175+
End Try
172176
End Sub
173177

174178
<TestMethod>
175-
<ExpectedException(GetType(Exception))>
176179
Public Sub CompareSeries_UnsupportedFunction_ThrowsException()
177180
Dim sim As TimeSeries = CreateTimeSeries({1.0, 2.0, 3.0})
178181
Dim ref As TimeSeries = CreateTimeSeries({1.0, 2.0, 3.0})
179-
ObjectiveFunction.compareSeries(sim, ref, "UNSUPPORTED")
182+
Try
183+
ObjectiveFunction.compareSeries(sim, ref, "UNSUPPORTED")
184+
Assert.Fail("Expected exception for unsupported objective function was not thrown.")
185+
Catch ex As Exception
186+
'Expected exception, test passes
187+
End Try
180188
End Sub
181189

182190
End Class

BlueM.Opt/Tests/BlueM.Opt.Tests/tests.runsettings

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)