Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ac43fa4

Browse files
Tests | Enhance Visual Studio testing experience (#1161)
1 parent ad1e481 commit ac43fa4

34 files changed

+179
-847
lines changed

build.proj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,21 @@
6262
<Target Name="BuildTestsNetFx" DependsOnTargets="RestoreTestsNetFx;BuildAKVNetFx;BuildFunctionalTestsNetFx;BuildManualTestsNetFx;" />
6363

6464
<Target Name="RestoreNetCore">
65-
<MSBuild Projects="@(NetCoreDriver)" Targets="restore" Properties="TestTargetOS=$(TestOS)netcoreapp" />
65+
<MSBuild Projects="@(NetCoreDriver)" Targets="restore" />
6666
</Target>
6767

6868
<Target Name="RestoreTestsNetCore">
69-
<MSBuild Projects="@(ManualTests)" Targets="restore" Properties="TestTargetOS=$(TestOS)netcoreapp" />
70-
<MSBuild Projects="@(FunctionalTests)" Targets="restore" Properties="TestTargetOS=$(TestOS)netcoreapp" />
69+
<MSBuild Projects="@(ManualTests)" Targets="restore" />
70+
<MSBuild Projects="@(FunctionalTests)" Targets="restore" />
7171
</Target>
7272

7373
<Target Name="RestoreNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
74-
<MSBuild Projects="@(NetFxDriver)" Targets="restore" Properties="TestTargetOS=$(TestOS)netfx" />
74+
<MSBuild Projects="@(NetFxDriver)" Targets="restore" />
7575
</Target>
7676

7777
<Target Name="RestoreTestsNetFx">
78-
<MSBuild Projects="@(ManualTests)" Targets="restore" Properties="TestTargetOS=$(TestOS)netfx" />
79-
<MSBuild Projects="@(FunctionalTests)" Targets="restore" Properties="TestTargetOS=$(TestOS)netfx" />
78+
<MSBuild Projects="@(ManualTests)" Targets="restore" />
79+
<MSBuild Projects="@(FunctionalTests)" Targets="restore" />
8080
</Target>
8181

8282
<Target Name="BuildTools" Condition="'$(BuildTools)' == 'true'">

src/Microsoft.Data.SqlClient.sln

Lines changed: 55 additions & 725 deletions
Large diffs are not rendered by default.

src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ProjectGuid>{9073ABEF-92E0-4702-BB23-2C99CEF9BDD7}</ProjectGuid>
77
<TargetGroup Condition="$(TargetFramework.StartsWith('netcoreapp')) OR $(TargetFramework.StartsWith('netstandard'))">netcoreapp</TargetGroup>
88
<TargetGroup Condition="$(TargetFramework.StartsWith('net4'))">netfx</TargetGroup>
9-
<Configurations>Debug;Release;net461-Release;net461-Debug;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release</Configurations>
9+
<Configurations>Debug;Release;</Configurations>
1010
<Platforms>AnyCPU;x86;x64</Platforms>
1111
<IntermediateOutputPath>$(ObjFolder)$(Configuration).$(Platform)\$(AddOnName)</IntermediateOutputPath>
1212
<OutputPath>$(BinFolder)$(Configuration).$(Platform)\$(AddOnName)</OutputPath>

src/Microsoft.Data.SqlClient/add-ons/Directory.Build.props

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,41 @@
55
<Import Project="..\..\Directory.Build.props" />
66

77
<PropertyGroup>
8+
<OSGroup Condition="$(OSGroup) == ''">$(OS)</OSGroup>
9+
<TargetsWindows Condition="'$(OSGroup)'=='Windows_NT'">true</TargetsWindows>
10+
<TargetsUnix Condition="'$(OSGroup)'=='Unix'">true</TargetsUnix>
811
<ReferenceType Condition="'$(ReferenceType)'==''">Project</ReferenceType>
912
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
1013
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
14+
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
1115
</PropertyGroup>
12-
16+
17+
<!--These properties can be modified locally to target .NET version of choice to build and test entire test suite-->
1318
<PropertyGroup>
14-
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
19+
<TargetNetFxVersion Condition="'$(TargetNetFxVersion)' == ''">net461</TargetNetFxVersion>
20+
<TargetNetStandardVersion Condition="'$(TargetNetStandardVersion)' == ''">netstandard2.0</TargetNetStandardVersion>
21+
<TargetNetCoreVersion Condition="'$(ReferenceType)' == 'NetStandard' AND $(TargetNetStandardVersion)=='netstandard2.1'">netcoreapp3.1</TargetNetCoreVersion>
22+
<TargetNetCoreVersion Condition="'$(TargetNetCoreVersion)' == ''">netcoreapp2.1</TargetNetCoreVersion>
1523
</PropertyGroup>
24+
1625
<ItemGroup>
1726
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)"/>
1827
</ItemGroup>
1928
<Choose>
2029
<!-- Set Default Target Framework when building for Debug and Release configurations. (Visual Studio) -->
21-
<When Condition="'$(TestTargetOS)' == '' AND ('$(Configuration)' == 'Debug' OR '$(Configuration)' == 'Release')">
22-
<PropertyGroup>
23-
<TargetFramework>netcoreapp2.1</TargetFramework>
24-
</PropertyGroup>
25-
</When>
26-
<!-- Set Target Framework when TestTargetOS is not empty. (Command Line) -->
27-
<When Condition="'$(TestTargetOS)' != ''">
28-
<PropertyGroup>
29-
<TargetFramework Condition="'$(TestTargetOS)' == 'Windowsnetstandard' OR '$(TestTargetOS)' == 'Unixnetstandard'">netstandard2.0</TargetFramework>
30-
<TargetFramework Condition="'$(TestTargetOS)' == 'Windowsnetcoreapp' OR '$(TestTargetOS)' == 'Unixnetcoreapp'">netcoreapp2.1</TargetFramework>
31-
<TargetFramework Condition="('$(TestTargetOS)' == 'Windowsnetcoreapp' OR '$(TestTargetOS)' == 'Unixnetcoreapp') AND ($(ReferenceType)=='NetStandard' AND $(TargetNetStandardVersion)=='netstandard2.1')">netcoreapp3.1</TargetFramework>
32-
<TargetFramework Condition="'$(TestTargetOS)' == 'Windowsnetfx'">net461</TargetFramework>
30+
<When Condition="'$(TestTargetOS)' == ''">
31+
<PropertyGroup>
32+
<TargetFrameworks Condition="'$(TargetsWindows)' == 'true'">$(TargetNetFxVersion);$(TargetNetCoreVersion);$(TargetNetStandardVersion)</TargetFrameworks>
33+
<TargetFrameworks Condition="'$(TargetsUnix)' == 'true'">$(TargetNetCoreVersion);$(TargetNetStandardVersion)</TargetFrameworks>
3334
</PropertyGroup>
3435
</When>
35-
<!-- Set Target Framework when TestTargetOS is empty and Configuration is neither Debug nor Release. (Visual Studio) -->
36+
<!-- Set Target Framework when TestTargetOS is not empty. (Command Line) -->
3637
<Otherwise>
3738
<PropertyGroup>
38-
<TargetFramework>$(Configuration.Split('-')[0])</TargetFramework>
39+
<TargetFrameworks Condition="'$(TestTargetOS)' == 'Windowsnetstandard' OR '$(TestTargetOS)' == 'Unixnetstandard'">netstandard2.0;netstandard2.1</TargetFrameworks>
40+
<TargetFrameworks Condition="'$(TestTargetOS)' == 'Windowsnetcoreapp' OR '$(TestTargetOS)' == 'Unixnetcoreapp'">netcoreapp2.1</TargetFrameworks>
41+
<TargetFrameworks Condition="('$(TestTargetOS)' == 'Windowsnetcoreapp' OR '$(TestTargetOS)' == 'Unixnetcoreapp') AND ($(ReferenceType)=='NetStandard' AND $(TargetNetStandardVersion)=='netstandard2.1')">netcoreapp3.1</TargetFrameworks>
42+
<TargetFrameworks Condition="'$(TestTargetOS)' == 'Windowsnetfx'">net461</TargetFrameworks>
3943
</PropertyGroup>
4044
</Otherwise>
4145
</Choose>

src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<OutputPath>$(BinFolder)$(Configuration)\$(AssemblyName)\ref\</OutputPath>
88
<DocumentationFile>$(OutputPath)\$(TargetFramework)\Microsoft.Data.SqlClient.xml</DocumentationFile>
99
<Product>Core $(BaseProduct)</Product>
10-
<Configurations>Debug;Release;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release</Configurations>
10+
<Configurations>Debug;Release;</Configurations>
1111
<TargetGroup Condition="$(TargetFramework.StartsWith('netcoreapp'))">netcoreapp</TargetGroup>
1212
<TargetGroup Condition="$(TargetFramework.StartsWith('netstandard'))">netstandard</TargetGroup>
1313
<Platforms>AnyCPU;x64;x86</Platforms>

src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
1212
<TargetGroup Condition="$(TargetFramework.StartsWith('netcoreapp'))">netcoreapp</TargetGroup>
1313
<TargetGroup Condition="$(TargetFramework.StartsWith('netstandard'))">netstandard</TargetGroup>
14-
<Configurations>Debug;Release;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release</Configurations>
14+
<Configurations>Debug;Release;</Configurations>
1515
<Platforms>AnyCPU;x64;x86</Platforms>
1616
<IntermediateOutputPath>$(ObjFolder)$(Configuration).$(Platform)\$(AssemblyName)\netcore\</IntermediateOutputPath>
1717
<OutputPath>$(BinFolder)$(Configuration).$(Platform)\$(AssemblyName)\netcore\</OutputPath>

src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<OutputPath>$(BinFolder)$(Configuration)\$(AssemblyName)\ref\</OutputPath>
77
<DocumentationFile>$(OutputPath)\Microsoft.Data.SqlClient.xml</DocumentationFile>
88
<Product>Framework $(BaseProduct)</Product>
9-
<Configurations>Debug;Release;net461-Release;net461-Debug</Configurations>
9+
<Configurations>Debug;Release;</Configurations>
1010
</PropertyGroup>
1111
<ItemGroup>
1212
<Compile Include="Microsoft.Data.SqlClient.cs" />

src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@
6363
<!-- All Available Configurations-->
6464
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
6565
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
66-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net461-Debug|AnyCPU'" />
67-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net461-Release|AnyCPU'" />
6866
<PropertyGroup Condition="$(Configuration.Contains('Debug'))">
6967
<DefineConstants>$(DefineConstants);DEBUG;DBG;_DEBUG;_LOGGING;RESOURCE_ANNOTATION_WORK;</DefineConstants>
7068
<DebugType>Full</DebugType>

src/Microsoft.Data.SqlClient/tests/CustomConfigurableRetryLogic/CustomRetryLogicProvider.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
<AssemblyName>ExternalConfigurableRetryLogic</AssemblyName>
44
<TargetGroup Condition="$(TargetFramework.StartsWith('net4'))">netfx</TargetGroup>
55
<TargetGroup Condition="$(TargetGroup) == ''">netcoreapp</TargetGroup>
6-
<OSGroup Condition="'$(OSGroup)' == ''">$(OS)</OSGroup>
7-
<TargetsWindows Condition="'$(OSGroup)'=='Windows_NT'">true</TargetsWindows>
8-
<TargetsUnix Condition="'$(OSGroup)'=='Unix'">true</TargetsUnix>
96
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
10-
<Configurations>Debug;Release;net461-Release;net461-Debug;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release</Configurations>
11-
<Platforms>AnyCPU;x86;x64</Platforms>
127
<IntermediateOutputPath>$(ObjFolder)$(Configuration).$(Platform).$(AssemblyName)</IntermediateOutputPath>
138
<OutputPath>$(BinFolder)$(Configuration).$(Platform).$(AssemblyName)</OutputPath>
149
</PropertyGroup>

src/Microsoft.Data.SqlClient/tests/Directory.Build.props

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,37 @@
44

55
<!-- Import parent Directory.build.props -->
66
<Import Project="..\..\Directory.Build.props" />
7+
8+
<PropertyGroup>
9+
<OSGroup Condition="$(OSGroup) == ''">$(OS)</OSGroup>
10+
<TargetsWindows Condition="'$(OSGroup)'=='Windows_NT'">true</TargetsWindows>
11+
<TargetsUnix Condition="'$(OSGroup)'=='Unix'">true</TargetsUnix>
12+
<Configurations>Debug;Release;</Configurations>
13+
<Platforms>AnyCPU;x86;x64</Platforms>
14+
<ReferenceType Condition="'$(ReferenceType)'==''">Project</ReferenceType>
15+
</PropertyGroup>
716

17+
<!--These properties can be modified locally to target .NET version of choice to build and test entire test suite-->
818
<PropertyGroup>
919
<TargetNetFxVersion Condition="'$(TargetNetFxVersion)' == ''">net461</TargetNetFxVersion>
1020
<TargetNetCoreVersion Condition="'$(ReferenceType)' == 'NetStandard' AND $(TargetNetStandardVersion)=='netstandard2.1'">netcoreapp3.1</TargetNetCoreVersion>
1121
<TargetNetCoreVersion Condition="'$(TargetNetCoreVersion)' == ''">netcoreapp2.1</TargetNetCoreVersion>
12-
<ReferenceType Condition="'$(ReferenceType)'==''">Project</ReferenceType>
1322
</PropertyGroup>
1423

1524
<Choose>
1625
<!-- Set Default Target Framework when building for Debug and Release configurations. (Visual Studio) -->
17-
<When Condition="'$(TestTargetOS)' == '' AND ('$(Configuration)' == 'Debug' OR '$(Configuration)' == 'Release')">
26+
<When Condition="'$(TestTargetOS)' == ''">
1827
<PropertyGroup>
19-
<TargetFrameworks>$(TargetNetCoreVersion)</TargetFrameworks>
28+
<TargetFrameworks Condition="'$(TargetsWindows)' == 'true'">$(TargetNetFxVersion);$(TargetNetCoreVersion);</TargetFrameworks>
29+
<TargetFrameworks Condition="'$(TargetsUnix)' == 'true'">$(TargetNetCoreVersion);</TargetFrameworks>
2030
</PropertyGroup>
2131
</When>
2232
<!-- Set Target Framework when TestTargetOS is not empty. (Command Line) -->
23-
<When Condition="'$(TestTargetOS)' != ''">
33+
<Otherwise>
2434
<PropertyGroup>
2535
<TargetFrameworks Condition="'$(TestTargetOS)' == 'Windowsnetcoreapp' OR '$(TestTargetOS)' == 'Unixnetcoreapp'">$(TargetNetCoreVersion)</TargetFrameworks>
2636
<TargetFrameworks Condition="'$(TestTargetOS)' == 'Windowsnetfx'">$(TargetNetFxVersion)</TargetFrameworks>
2737
</PropertyGroup>
28-
</When>
29-
<!-- Set Target Framework when TestTargetOS is empty and Configuration is neither Debug nor Release. (Visual Studio) -->
30-
<Otherwise>
31-
<PropertyGroup>
32-
<TargetFrameworks>$(Configuration.Split('-')[0])</TargetFrameworks>
33-
</PropertyGroup>
3438
</Otherwise>
3539
</Choose>
3640
</Project>

0 commit comments

Comments
 (0)