Skip to content

Commit

Permalink
Use Arcade (dotnet/extensions#586)
Browse files Browse the repository at this point in the history
Use arcade


Commit migrated from dotnet/extensions@f045899
  • Loading branch information
ryanbrandenburg committed Jan 29, 2019
1 parent 631507a commit 136dc4d
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
<PackageTags>aspnetcore</PackageTags>
<EnableApiCheck>false</EnableApiCheck>
<IsPackable>true</IsPackable>
<IsShipping>false</IsShipping>
<!-- This package is internal, so we don't generate a package baseline. Always build against the latest dependencies. -->
<UseLatestPackageReferences>true</UseLatestPackageReferences>
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="Microsoft.AspNetCore.Testing.Tests" />
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.Win32.Registry" />
<Reference Include="System.ValueTuple" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
Expand All @@ -8,6 +8,11 @@ namespace Microsoft.AspNetCore.Testing
{
public class TestPathUtilities
{
public static string GetRepoRootDirectory()
{
return GetSolutionRootDirectory("Extensions");
}

public static string GetSolutionRootDirectory(string solution)
{
var applicationBasePath = AppContext.BaseDirectory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ protected override IXunitTestCase CreateTestCase(ITestFrameworkDiscoveryOptions
{
var skipReason = testMethod.EvaluateSkipConditions();
return skipReason != null
? new SkippedTestCase(skipReason, _diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod)
? new SkippedTestCase(skipReason, _diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), TestMethodDisplayOptions.None, testMethod)
: base.CreateTestCase(discoveryOptions, testMethod, factAttribute);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ namespace Microsoft.AspNetCore.Testing.xunit
public class ConditionalTheoryAttribute : TheoryAttribute
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,30 @@ public ConditionalTheoryDiscoverer(IMessageSink diagnosticMessageSink)
{
}

private sealed class OptionsWithPreEnumerationEnabled : ITestFrameworkDiscoveryOptions
{
private const string PreEnumerateTheories = "xunit.discovery.PreEnumerateTheories";

private readonly ITestFrameworkDiscoveryOptions _original;

public OptionsWithPreEnumerationEnabled(ITestFrameworkDiscoveryOptions original)
=> _original = original;

public TValue GetValue<TValue>(string name)
=> (name == PreEnumerateTheories) ? (TValue)(object)true : _original.GetValue<TValue>(name);

public void SetValue<TValue>(string name, TValue value)
=> _original.SetValue(name, value);
}

public override IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo theoryAttribute)
=> base.Discover(new OptionsWithPreEnumerationEnabled(discoveryOptions), testMethod, theoryAttribute);

protected override IEnumerable<IXunitTestCase> CreateTestCasesForTheory(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo theoryAttribute)
{
var skipReason = testMethod.EvaluateSkipConditions();
return skipReason != null
? new[] { new SkippedTestCase(skipReason, DiagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod) }
? new[] { new SkippedTestCase(skipReason, DiagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), TestMethodDisplayOptions.None, testMethod) }
: base.CreateTestCasesForTheory(discoveryOptions, testMethod, theoryAttribute);
}

Expand All @@ -44,4 +63,4 @@ protected override IEnumerable<IXunitTestCase> CreateTestCasesForDataRow(ITestFr
: base.CreateTestCasesForDataRow(discoveryOptions, testMethod, theoryAttribute, dataRow);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
Expand All @@ -16,8 +16,14 @@ public SkippedTestCase() : base()
{
}

public SkippedTestCase(string skipReason, IMessageSink diagnosticMessageSink, TestMethodDisplay defaultMethodDisplay, ITestMethod testMethod, object[] testMethodArguments = null)
: base(diagnosticMessageSink, defaultMethodDisplay, testMethod, testMethodArguments)
public SkippedTestCase(
string skipReason,
IMessageSink diagnosticMessageSink,
TestMethodDisplay defaultMethodDisplay,
TestMethodDisplayOptions defaultMethodDisplayOptions,
ITestMethod testMethod,
object[] testMethodArguments = null)
: base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod, testMethodArguments)
{
_skipReason = skipReason;
}
Expand All @@ -37,4 +43,4 @@ public override void Serialize(IXunitSerializationInfo data)
data.AddValue(nameof(_skipReason), _skipReason);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<Reference Include="System.Net.Http" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void GetSolutionRootDirectory_ResolvesSolutionRoot()
// Testing\test\Microsoft.AspNetCore.Testing.Tests\bin\Debug\netcoreapp2.0
// Testing\test\Microsoft.AspNetCore.Testing.Tests\bin\Debug\net461
// Testing\test\Microsoft.AspNetCore.Testing.Tests\bin\Debug\net46
var expectedPath = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "..", "..", ".."));
var expectedPath = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", ".."));

Assert.Equal(expectedPath, TestPathUtilities.GetSolutionRootDirectory("Extensions"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@

<PropertyGroup>
<IsProductComponent>true</IsProductComponent>
<IsPackable>true</IsPackable>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>cache;memorycache</PackageTags>
<IsPackable>true</IsPackable>
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="Microsoft.Extensions.Caching.Memory.Tests" />
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.Extensions.Caching.Abstractions" />
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;httpclient</PackageTags>
<IsPackable>true</IsPackable>
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="Microsoft.Extensions.Http.Tests" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(SharedSourceRoot)NonCapturingTimer\**\*.cs" />
<Compile Include="$(SharedSourceRoot)TypeNameHelper\**\*.cs" />
Expand Down

This file was deleted.

0 comments on commit 136dc4d

Please sign in to comment.