Skip to content

Commit b500cc7

Browse files
authored
Merge pull request #69 from TestCentric/build-props
Use Directory.Build.props
2 parents f0c63d7 + e1fbc61 commit b500cc7

File tree

15 files changed

+115
-92
lines changed

15 files changed

+115
-92
lines changed

src/DirectTestAgent/DirectTestAgent.csproj

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@
55
<OutputType>Exe</OutputType>
66
<TargetFrameworks>net20;net462;netstandard2.0;netcoreapp3.1;net6.0;net7.0;net8.0</TargetFrameworks>
77
<OutputPath>..\..\bin\$(Configuration)\direct-test-agent\</OutputPath>
8-
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
9-
<CheckEolTargetFramework>false</CheckEolTargetFramework>
108
</PropertyGroup>
119

1210
<ItemGroup>
1311
<ProjectReference Include="..\TestCentric.Agent.Core\TestCentric.Agent.Core.csproj" />
1412
</ItemGroup>
1513

1614
<ItemGroup>
17-
<PackageReference Include="TestCentric.Engine.Api" Version="2.0.0-dev00009" />
18-
<PackageReference Include="TestCentric.Extensibility" Version="4.0.0-dev00002" />
19-
<PackageReference Include="TestCentric.InternalTrace" Version="1.2.1" />
15+
<PackageReference Include="TestCentric.Engine.Api" Version="$(EngineVersion)" />
16+
<PackageReference Include="TestCentric.Extensibility" Version="$(ExtensibilityVersion)" />
17+
<PackageReference Include="TestCentric.InternalTrace" Version="$(InternalTraceVersion)" />
2018
</ItemGroup>
2119

2220
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.1'">

src/Directory.Build.props

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<!-- Top level Directory.Build.props -->
2+
<Project>
3+
4+
<PropertyGroup>
5+
<!-- Compile and Build Settings -->
6+
<LangVersion>12</LangVersion>
7+
<Features>strict</Features>
8+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
9+
<!--<EnableNETAnalyzers>true</EnableNETAnalyzers>
10+
<AnalysisMode>Minimum</AnalysisMode>
11+
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>-->
12+
<Version Condition="'$(Version)'==''">2.0.0.0</Version>
13+
<OutputPath>$(MSBuildThisFileDirectory)\..\bin\$(Configuration)\</OutputPath>
14+
<CheckEolTargetFramework>false</CheckEolTargetFramework>
15+
<RollForward>Major</RollForward>
16+
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
17+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
18+
<!-- Signing Assemblies -->
19+
<SignAssembly>true</SignAssembly>
20+
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)\testcentric.snk</AssemblyOriginatorKeyFile>
21+
<!-- Debugging -->
22+
<DebugType>portable</DebugType>
23+
<DebugSymbols>true</DebugSymbols>
24+
<!-- Commonly Used Package Versions -->
25+
<EngineVersion>2.0.0-dev01659</EngineVersion>
26+
<ExtensibilityVersion>4.0.0-dev00004</ExtensibilityVersion>
27+
<MetadataVersion>3.0.4</MetadataVersion>
28+
<InternalTraceVersion>1.2.1</InternalTraceVersion>
29+
<!-- Informational Settings -->
30+
<Company>TestCentric</Company>
31+
<Product>TestCentric Gui Runner and Engine</Product>
32+
<Trademark>TestCentric is a trademark of the TestCentric Project</Trademark>
33+
<!-- Keys for Friend Assemblies -->
34+
<NUnitPublicKey>002400000480000094000000060200000024000052534131000400000100010031eea370b1984bfa6d1ea760e1ca6065cee41a1a279ca234933fe977a096222c0e14f9e5a17d5689305c6d7f1206a85a53c48ca010080799d6eeef61c98abd18767827dc05daea6b6fbd2e868410d9bee5e972a004ddd692dec8fa404ba4591e847a8cf35de21c2d3723bc8d775a66b594adeb967537729fe2a446b548cd57a6</NUnitPublicKey>
35+
<NSubstitutePublicKey>0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7</NSubstitutePublicKey>
36+
</PropertyGroup>
37+
38+
<!-- Version of NUnit and NSubstitute used depends on the target framework -->
39+
<PropertyGroup Condition="'$(TargetFramework)'=='net35'
40+
OR '$(TargetFramework)'=='netcoreapp2.1' OR '$(TargetFramework)'=='netcoreapp3.1'
41+
OR '$(TargetFramework)'=='net5.0' Or '$(TargetFramework)'=='net5.0-windows'" >
42+
<NUnitVersion>3.14.0</NUnitVersion>
43+
<NSubstituteVersion>2.0.3</NSubstituteVersion>
44+
</PropertyGroup>
45+
46+
<!-- Default versions for targets not listed above -->
47+
<PropertyGroup>
48+
<NUnitVersion Condition="'$(NUnitVersion)'==''">4.1.0</NUnitVersion>
49+
<NSubstituteVersion Condition="'$(NSubstituteVersion)'==''">5.3.0</NSubstituteVersion>
50+
</PropertyGroup>
51+
52+
<!-- Common package metadata, may be overridden in individual projects -->
53+
<!-- Each project should supply properties for PackageId, Title and Description -->
54+
<PropertyGroup>
55+
<PackageOutputPath>$(MSBuildThisFileDirectory)..\package</PackageOutputPath>
56+
<IncludeSymbols>true</IncludeSymbols>
57+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
58+
<Authors>CharliePoole</Authors>
59+
<Owners>CharliePoole</Owners>
60+
<Copyright>Charlie Poole and TestCentric Contributors. MIT License.</Copyright>
61+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
62+
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
63+
<RequireLicenseAcceptance>false</RequireLicenseAcceptance>
64+
<PackageProjectUrl>>https://test-centric.org</PackageProjectUrl>
65+
<!--<PackageIcon>testcentric.png</PackageIcon>
66+
<PackageIconUrl>https://cdn.rawgit.com/nunit/resources/master/images/icon/nunit_256.png</PackageIconUrl>
67+
<PackageReleaseNotes>https://docs.nunit.org/articles/nunit/release-notes/console-and-engine.html</PackageReleaseNotes>-->
68+
<RepositoryUrl>https://github.com/TestCentric/testcentric-gui</RepositoryUrl>
69+
<!--<ReleaseNotes>https://docs.nunit.org/articles/nunit/release-notes/console-and-engine.html</ReleaseNotes>-->
70+
</PropertyGroup>
71+
72+
<ItemGroup>
73+
<None Include="$(MSBuildThisFileDirectory)..\LICENSE.txt" Pack="true" PackagePath="\" />
74+
<None Include="$(MSBuildThisFileDirectory)..\testcentric.png" Pack="true" PackagePath="\" />
75+
</ItemGroup>
76+
77+
<!-- Code Style Analyzers -->
78+
<!--<ItemGroup>
79+
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556" PrivateAssets="all" />
80+
<GlobalAnalyzerConfigFiles Include="$(MSBuildThisFileDirectory)/StyleCop.Analyzers.globalconfig" />
81+
<PackageReference Include="CSharpIsNullAnalyzer" Version="0.1.593" PrivateAssets="all" />
82+
</ItemGroup>-->
83+
84+
</Project>

src/TestCentric.Agent.Core.Tests/TestCentric.Agent.Core.Tests.csproj

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
<TargetFrameworks>net35;net462;netcoreapp3.1;net6.0;net8.0</TargetFrameworks>
66
<OutputType>Exe</OutputType>
77
<OutputPath>..\..\bin\$(Configuration)\agent-core-tests\</OutputPath>
8-
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
9-
<CheckEolTargetFramework>false</CheckEolTargetFramework>
10-
<PlatformTarget>AnyCPU</PlatformTarget>
118
</PropertyGroup>
129

1310
<!-- Suppress warnings due to use of version 7.0 of Microsoft.Extensions.DependencyModel -->
@@ -27,19 +24,14 @@
2724
<Reference Include="System.Web" />
2825
</ItemGroup>
2926

30-
<ItemGroup Condition="'$(TargetFramework)' == 'net35' Or '$(TargetFramework)' == 'netcoreapp3.1'">
31-
<PackageReference Include="NUnit" Version="3.14.0" />
32-
<PackageReference Include="NUnitLite" Version="3.14.0" />
33-
</ItemGroup>
34-
35-
<ItemGroup Condition="'$(TargetFramework)' == 'net462' Or '$(TargetFramework)' == 'net6.0' Or '$(TargetFramework)' == 'net8.0'">
36-
<PackageReference Include="NUnit" Version="4.1.0" />
37-
<PackageReference Include="NUnitLite" Version="4.1.0" />
27+
<ItemGroup>
28+
<PackageReference Include="NUnit" Version="$(NUnitVersion)" />
29+
<PackageReference Include="NUnitLite" Version="$(NUnitVersion)" />
3830
</ItemGroup>
3931

4032
<ItemGroup>
41-
<PackageReference Include="TestCentric.Engine.Api" Version="2.0.0-dev00009" />
42-
<PackageReference Include="TestCentric.Extensibility" Version="4.0.0-dev00002" />
33+
<PackageReference Include="TestCentric.Engine.Api" Version="$(EngineVersion)" />
34+
<PackageReference Include="TestCentric.Extensibility" Version="$(ExtensibilityVersion)" />
4335
</ItemGroup>
4436

4537
<ItemGroup>

src/TestCentric.Agent.Core/AgentDirectRunner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private void WriteHeader()
8383
OutWriter.WriteLine();
8484
}
8585

86-
private TAttr GetAttribute<TAttr>(Assembly assembly) where TAttr : Attribute
86+
private static TAttr GetAttribute<TAttr>(Assembly assembly) where TAttr : Attribute
8787
{
8888
#if (NETCOREAPP || NET462_OR_GREATER)
8989
return assembly?.GetCustomAttribute<TAttr>();

src/TestCentric.Agent.Core/AgentOptions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,19 @@ private static bool IsOption(string arg)
120120
return arg.StartsWith("--");
121121
}
122122

123-
private void ValueRequiredError(string arg) =>
123+
private static void ValueRequiredError(string arg) =>
124124
throw new Exception($"Option requires a value: {arg}");
125125

126-
private void ValueNotAllowedError(string arg) =>
126+
private static void ValueNotAllowedError(string arg) =>
127127
throw new Exception($"Option does not take a value: {arg}");
128128

129-
private void InvalidArgumentError(string arg) =>
129+
private static void InvalidArgumentError(string arg) =>
130130
throw new Exception($"Invalid argument: {arg}");
131131

132-
private void FileNotFoundError(string arg) =>
132+
private static void FileNotFoundError(string arg) =>
133133
throw new FileNotFoundException($"FileNotFound: {arg}");
134134

135-
private void TooManyFilesError(int count) =>
135+
private static void TooManyFilesError(int count) =>
136136
throw new ArgumentException($"Only one file argument is allowed but {count} were supplied");
137137
}
138138
}

src/TestCentric.Agent.Core/Communication/Transports/Tcp/TestAgentTcpTransport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public TestAgentTcpTransport(RemoteTestAgent agent, string serverUrl)
3434
Guard.ArgumentNotNullOrEmpty(serverUrl, nameof(serverUrl));
3535
_agencyUrl = serverUrl;
3636

37-
var parts = serverUrl.Split(new char[] { ':' });
37+
var parts = serverUrl.Split([':']);
3838
Guard.ArgumentValid(parts.Length == 2, "Invalid server address specified. Must be a valid endpoint including the port number", nameof(serverUrl));
3939
ServerEndPoint = new IPEndPoint(IPAddress.Parse(parts[0]), int.Parse(parts[1]));
4040
log.Debug($"Using server EndPoint {ServerEndPoint}");

src/TestCentric.Agent.Core/Drivers/DriverService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class DriverService : IDriverService
2222
{
2323
static readonly Logger log = InternalTrace.GetLogger("DriverService");
2424

25-
readonly IList<IDriverFactory> _factories = new List<IDriverFactory>();
25+
readonly List<IDriverFactory> _factories = new List<IDriverFactory>();
2626

2727
public DriverService()
2828
{
@@ -69,7 +69,7 @@ public IFrameworkDriver GetDriver(AppDomain domain, string assemblyPath, string
6969
// any true Portable assembly would have a Profile as part of its name.
7070
var platform = targetFramework == ".NETPortable,Version=v5.0"
7171
? ".NETStandard"
72-
: targetFramework.Split(new char[] { ',' })[0];
72+
: targetFramework.Split([','])[0];
7373

7474
if (platform == "Silverlight" || platform == ".NETPortable" || platform == ".NETStandard" || platform == ".NETCompactFramework")
7575
return new InvalidAssemblyFrameworkDriver(assemblyPath, platform + " test assemblies are not supported by this version of the engine");

src/TestCentric.Agent.Core/Drivers/NUnit3DriverFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public IFrameworkDriver GetDriver(AppDomain domain, AssemblyName reference)
5050
/// <returns></returns>
5151
public IFrameworkDriver GetDriver(AssemblyName reference)
5252
{
53-
Guard.ArgumentValid(IsSupportedTestFramework(reference), "Invalid framework", "reference");
53+
Guard.ArgumentValid(IsSupportedTestFramework(reference), "Invalid framework", nameof(reference));
5454
#if NETSTANDARD
5555
log.Info("Using NUnitNetStandardDriver");
5656
return new NUnitNetStandardDriver();

src/TestCentric.Agent.Core/Internal/RuntimeInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static RuntimeInfo FromText(string text)
3434

3535
var name = text.Substring(0, index1);
3636
var version = text.Substring(index1 + 1, index2 - index1 - 1);
37-
var basedir = text.Substring(index2 + 1).Trim(new[] { ' ', '[', ']' });
37+
var basedir = text.Substring(index2 + 1).Trim([' ', '[', ']']);
3838
var location = Path.Combine(basedir, version);
3939
//var location = basedir + Path.DirectorySeparatorChar + version;
4040

src/TestCentric.Agent.Core/Resolvers/TrustedPlatformResolutionStrategy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal class TrustedPlatformResolutionStrategy : ResolutionStrategy
1717
{
1818
private static readonly Logger log = InternalTrace.GetLogger(nameof(TrustedPlatformResolutionStrategy));
1919

20-
private readonly string[] _trustedAssemblies = new string[0];
20+
private readonly string[] _trustedAssemblies = Array.Empty<string>();
2121

2222
public TrustedPlatformResolutionStrategy(TestAssemblyResolver resolver) : base(resolver)
2323
{

0 commit comments

Comments
 (0)