Pass in -ci and -test to CI (#2893)
* run unit tests in CI * pass in ci flag * feedback * Use arcade xunit version and add test ruleset * Fix test failures Co-authored-by: Santiago Fernandez Madero <safern@microsoft.com>
This commit is contained in:
Родитель
e40153f279
Коммит
7e4a48c0df
|
@ -46,7 +46,7 @@ jobs:
|
|||
/p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory)
|
||||
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
|
||||
- name: _buildArguments
|
||||
value: -Configuration $(_BuildConfig) -ci -sign /p:BuildPackages=true -pack -publish $(_InternalBuildArgs)
|
||||
value: -Configuration $(_BuildConfig) -ci -sign -pack -publish $(_InternalBuildArgs)
|
||||
- name: _SignType
|
||||
value: real
|
||||
- group: DotNet-MyGet-Publish
|
||||
|
@ -60,7 +60,7 @@ jobs:
|
|||
|
||||
- ${{ if eq(parameters.isOfficialBuild, 'false') }}:
|
||||
- name: _buildArguments
|
||||
value: -Configuration $(_BuildConfig)
|
||||
value: -Configuration $(_BuildConfig) -test -ci -pack
|
||||
|
||||
pool: ${{ parameters.pool }}
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<RuleSet Name="Tests ruleset" Description="All Rules are disabled." ToolsVersion="15.0">
|
||||
<Rules AnalyzerId="xunit.analyzers" RuleNamespace="xunit.analyzers">
|
||||
<Rule Id="xUnit1008" Action="None" /> <!-- Test data attribute should only be used on a Theory -->
|
||||
<Rule Id="xUnit1010" Action="None" /> <!-- The value is not convertible to the method parameter type -->
|
||||
<Rule Id="xUnit1012" Action="None" /> <!-- Null should not be used for value type parameters -->
|
||||
<Rule Id="xUnit1013" Action="None" /> <!-- Public method should be marked as test -->
|
||||
<Rule Id="xUnit1014" Action="None" /> <!-- MemberData should use nameof operator for member name -->
|
||||
<Rule Id="xUnit1019" Action="None" /> <!-- MemberData must reference a member providing a valid data type -->
|
||||
<Rule Id="xUnit1024" Action="None" /> <!-- Test methods cannot have overloads -->
|
||||
<Rule Id="xUnit1025" Action="None" /> <!-- InlineData should be unique within the Theory it belongs to -->
|
||||
<Rule Id="xUnit1026" Action="None" /> <!-- Theory methods should use all of their parameters -->
|
||||
<Rule Id="xUnit2000" Action="None" /> <!-- Constants and literals should be the expected argument -->
|
||||
<Rule Id="xUnit2002" Action="None" /> <!-- Do not use null check on value type -->
|
||||
<Rule Id="xUnit2003" Action="None" /> <!-- Do not use equality check to test for null value -->
|
||||
<Rule Id="xUnit2004" Action="None" /> <!-- Do not use equality check to test for boolean conditions -->
|
||||
<Rule Id="xUnit2005" Action="None" /> <!-- Do not use identity check on value type -->
|
||||
<Rule Id="xUnit2012" Action="None" /> <!-- Do not use Enumerable.Any() to check if a value exists in a collection -->
|
||||
<Rule Id="xUnit2013" Action="None" /> <!-- Do not use equality check to check for collection size -->
|
||||
<Rule Id="xUnit2015" Action="None" /> <!-- Do not use typeof expression to check the exception type -->
|
||||
<Rule Id="xUnit2017" Action="None" /> <!-- Do not use Contains() to check if a value exists in a collection -->
|
||||
</Rules>
|
||||
</RuleSet>
|
|
@ -14,7 +14,6 @@
|
|||
<SystemThreadingTasksExtensionsVersion>4.5.1</SystemThreadingTasksExtensionsVersion>
|
||||
<LibuvVersion>1.9.1</LibuvVersion>
|
||||
<TestSdkVersion>15.0.0</TestSdkVersion>
|
||||
<XunitVersion>2.2.0</XunitVersion>
|
||||
<BenchmarkDotNetVersion>0.11.3</BenchmarkDotNetVersion>
|
||||
<SnVersion>1.0.0</SnVersion>
|
||||
<VSWhereVersion>2.5.2</VSWhereVersion>
|
||||
|
|
|
@ -7,5 +7,6 @@
|
|||
<ProjectReference Include="..\..\src\ALCProxy.Proxy\ALCProxy.Proxy.csproj" />
|
||||
<ProjectReference Include="..\ALCProxy.TestInterfaceUpdated\ALCProxy.TestInterfaceUpdated.csproj" />
|
||||
<ProjectReference Include="..\ALCProxy.TestInterface\ALCProxy.TestInterface.csproj" />
|
||||
<ProjectReference Include="..\ALCProxy.TestAssembly\ALCProxy.TestAssembly.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -170,15 +170,11 @@ namespace ALCProxy.Tests
|
|||
}
|
||||
public class ALCProxyTests
|
||||
{
|
||||
private readonly string _dbgString;
|
||||
|
||||
public ALCProxyTests () {
|
||||
#if DEBUG
|
||||
_dbgString = "Debug";
|
||||
#else
|
||||
_dbgString = "Release";
|
||||
#endif
|
||||
private readonly string _testAssemblyPath;
|
||||
|
||||
public ALCProxyTests ()
|
||||
{
|
||||
_testAssemblyPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ALCProxy.TestAssembly.dll");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -310,18 +306,8 @@ namespace ALCProxy.Tests
|
|||
[Fact]
|
||||
public void CanLoadOustideAssemblyWithSharedInterface()
|
||||
{
|
||||
string pathOfCurrentString = "ALCProxy.Tests";
|
||||
string assemblyLocation = Assembly.GetExecutingAssembly().Location;
|
||||
string newPath = Path.Combine(
|
||||
new string[] {
|
||||
assemblyLocation.Substring(0, assemblyLocation.IndexOf(pathOfCurrentString)),
|
||||
"ALCProxy.TestAssembly",
|
||||
"bin",
|
||||
_dbgString,
|
||||
"netcoreapp3.0",
|
||||
"ALCProxy.TestAssembly.dll" });
|
||||
TestAssemblyLoadContext alc = new TestAssemblyLoadContext("CanLoadOustideAssemblyWithSharedInterface", newPath, isCollectible: true);
|
||||
ALCProxy.TestInterface.IExternalClass a = ProxyBuilder<ALCProxy.TestInterface.IExternalClass, ClientDispatch>.CreateInstanceAndUnwrap(alc, Assembly.LoadFile(newPath).GetName(true), "ExternalClass", new object[] { });
|
||||
TestAssemblyLoadContext alc = new TestAssemblyLoadContext("CanLoadOustideAssemblyWithSharedInterface", _testAssemblyPath, isCollectible: true);
|
||||
ALCProxy.TestInterface.IExternalClass a = ProxyBuilder<ALCProxy.TestInterface.IExternalClass, ClientDispatch>.CreateInstanceAndUnwrap(alc, Assembly.LoadFile(_testAssemblyPath).GetName(true), "ExternalClass", new object[] { });
|
||||
Assert.Equal(5, a.GetUserParameter(5));
|
||||
Assert.Equal("CanLoadOustideAssemblyWithSharedInterface", a.GetCurrentContext());
|
||||
Dictionary<string, string> dict = new Dictionary<string, string>
|
||||
|
@ -343,18 +329,8 @@ namespace ALCProxy.Tests
|
|||
[Fact]
|
||||
public void CanLoadOustideAssemblyWithoutSharedInterface()
|
||||
{
|
||||
string pathOfCurrentString = "ALCProxy.Tests";
|
||||
string assemblyLocation = Assembly.GetExecutingAssembly().Location;
|
||||
string newPath = Path.Combine(
|
||||
new string[] {
|
||||
assemblyLocation.Substring(0, assemblyLocation.IndexOf(pathOfCurrentString)),
|
||||
"ALCProxy.TestAssembly",
|
||||
"bin",
|
||||
_dbgString,
|
||||
"netcoreapp3.0",
|
||||
"ALCProxy.TestAssembly.dll" });
|
||||
TestAssemblyLoadContext alc = new TestAssemblyLoadContext("CanLoadOustideAssemblyWithoutSharedInterface", newPath, isCollectible: true);
|
||||
ALCProxy.TestInterfaceUpdated.IExternalClass a = ProxyBuilder<ALCProxy.TestInterfaceUpdated.IExternalClass, ClientDispatch>.CreateInstanceAndUnwrap(alc, Assembly.LoadFile(newPath).GetName(true), "ExternalClass", new object[] { });
|
||||
TestAssemblyLoadContext alc = new TestAssemblyLoadContext("CanLoadOustideAssemblyWithoutSharedInterface", _testAssemblyPath, isCollectible: true);
|
||||
ALCProxy.TestInterfaceUpdated.IExternalClass a = ProxyBuilder<ALCProxy.TestInterfaceUpdated.IExternalClass, ClientDispatch>.CreateInstanceAndUnwrap(alc, Assembly.LoadFile(_testAssemblyPath).GetName(true), "ExternalClass", new object[] { });
|
||||
Assert.Equal(5, a.GetUserParameter(5));
|
||||
Assert.Equal("CanLoadOustideAssemblyWithoutSharedInterface", a.GetCurrentContext());
|
||||
Dictionary<string, string> dict = new Dictionary<string, string>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="$(BenchmarkDotNetVersion)" />
|
||||
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="2.0.30" />
|
||||
<PackageReference Include="System.Text.Encodings.Web" Version="$(CoreFxStableVersion)" />
|
||||
<PackageReference Include="xunit" Version="$(XUnitVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true"/>
|
||||
<PackageReference Include="xunit" Version="$(XUnitVersion)" IsImplicitlyDefined="true" PrivateAssets="all" ExcludeAssets="analyzers" Publish="true"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
|
|
|
@ -3,4 +3,7 @@
|
|||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\Directory.Build.props" />
|
||||
<PropertyGroup>
|
||||
<CodeAnalysisRuleset>$(RepositoryEngineeringDir)Tests.ruleset</CodeAnalysisRuleset>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -41,8 +41,6 @@ namespace System.Slices.Tests
|
|||
Span<byte> span = new Span<byte>(array);
|
||||
Assert.Equal(array.Length, span.Length);
|
||||
|
||||
Assert.NotSame(array, span.ToArray());
|
||||
|
||||
for (int i = 0; i < span.Length; i++)
|
||||
{
|
||||
Assert.Equal(array[i], Read<byte>(span.Slice(i)));
|
||||
|
@ -76,8 +74,6 @@ namespace System.Slices.Tests
|
|||
ReadOnlySpan<byte> span = new ReadOnlySpan<byte>(array);
|
||||
Assert.Equal(array.Length, span.Length);
|
||||
|
||||
Assert.NotSame(array, span.ToArray());
|
||||
|
||||
for (int i = 0; i < span.Length; i++)
|
||||
{
|
||||
Assert.Equal(array[i], Read<byte>(span.Slice(i)));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.0;netcoreapp3.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<!-- Project references -->
|
||||
<ItemGroup>
|
||||
|
|
Загрузка…
Ссылка в новой задаче