Split xunit2.dll into xunit.core.dll (PCL) and xunit.execution.dll (Net45).

This commit is contained in:
Brad Wilson 2014-03-08 11:21:59 -08:00
Родитель 1c0f29bfc2
Коммит 4ab4c54bf0
212 изменённых файлов: 527 добавлений и 662 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -18,3 +18,6 @@ help
Test*.html
Test*.xml
Index.dat
Storage.dat

Просмотреть файл

@ -16,7 +16,7 @@ internal static class ExceptionExtensions
/// </remarks>
public static void RethrowWithNoStackTraceLoss(this Exception ex)
{
#if XUNIT2_DLL
#if XUNIT_CORE_DLL
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(ex).Throw();
#else
FieldInfo remoteStackTraceString =

Просмотреть файл

@ -33,6 +33,7 @@ internal static class Guard
throw new ArgumentException(message, argName);
}
#if !XUNIT_CORE_DLL
/// <summary/>
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "This method may not be called by all users of Guard.")]
public static void FileExists(string argName, string fileName)
@ -42,4 +43,5 @@ internal static class Guard
String.Format("File not found: {0}", fileName),
File.Exists(fileName));
}
#endif
}

Просмотреть файл

@ -6,7 +6,7 @@ internal static class TestOptionsNames
internal static class Execution
{
public static readonly string DisableParallelization = "xunit2.DisableParallelization";
public static readonly string MaxParallelThreads = "xunit2.MaxParallelThreads";
public static readonly string DisableParallelization = "xunit.DisableParallelization";
public static readonly string MaxParallelThreads = "xunit.MaxParallelThreads";
}
}

Просмотреть файл

@ -17,7 +17,7 @@ namespace Xunit.Abstractions
/// </summary>
/// <remarks>
/// This is used by the test framework wrappers to find the co-located unit test framework
/// assembly (f.e., xunit.dll or xunit2.dll). AST-based runners will need to directly create
/// assembly (f.e., xunit.dll or xunit.execution.dll). AST-based runners will need to directly create
/// instances of <see cref="Xunit.Xunit1"/> and <see cref="Xunit.Xunit2"/> (using the constructors that
/// support an explicit path to the test framework DLL) rather than relying on the
/// use of <see cref="Xunit.XunitFrontController"/>.

Просмотреть файл

@ -13,8 +13,8 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
</metadata>
<files>
<file src="xunit2.assert\Asserts\*.cs" target="Content\Asserts" />
<file src="xunit2.assert\Asserts\Sdk\*.cs" target="Content\Asserts\Sdk" />
<file src="xunit2.assert\Asserts\Sdk\Exceptions\*.cs" target="Content\Asserts\Sdk\Exceptions" />
<file src="xunit.assert\Asserts\*.cs" target="Content\Asserts" />
<file src="xunit.assert\Asserts\Sdk\*.cs" target="Content\Asserts\Sdk" />
<file src="xunit.assert\Asserts\Sdk\Exceptions\*.cs" target="Content\Asserts\Sdk\Exceptions" />
</files>
</package>

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -3,5 +3,4 @@ using System.Reflection;
using System.Security;
[assembly: AssemblyTitle("xUnit.net Assertion Library")]
[assembly: AllowPartiallyTrustedCallers]
[assembly: CLSCompliant(true)]

Просмотреть файл

@ -10,7 +10,7 @@
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Xunit</RootNamespace>
<AssemblyName>xunit2.assert</AssemblyName>
<AssemblyName>xunit.assert</AssemblyName>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\Signing.snk</AssemblyOriginatorKeyFile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
@ -28,7 +28,7 @@
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\Debug\xunit2.assert.xml</DocumentationFile>
<DocumentationFile>bin\Debug\xunit.assert.xml</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@ -36,7 +36,7 @@
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>bin\Release\xunit2.assert.xml</DocumentationFile>
<DocumentationFile>bin\Release\xunit.assert.xml</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>

32
src/xunit.core.nuspec Normal file
Просмотреть файл

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata minClientVersion="2.5">
<id>xunit.core</id>
<version>2.0.0-alpha</version>
<title>xUnit.net [Core Library]</title>
<authors>James Newkirk, Brad Wilson</authors>
<description>Includes the core unit testing framework from xUnit.net (xunit.core.dll).</description>
<language>en-US</language>
<projectUrl>http://xunit.codeplex.com</projectUrl>
<iconUrl>http://download-codeplex.sec.s-msft.com/Download?ProjectName=xunit&amp;DownloadId=662625</iconUrl>
<licenseUrl>http://xunit.codeplex.com/license</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<references>
<reference file="xunit.core.dll" />
</references>
<dependencies>
<dependency id="xunit.abstractions" version="[2.0.0-alpha]" />
<!-- FOR WHEN WE RTM: -->
<!--<dependency id="xunit.abstractions" version="[2.0.0,2.1)" />-->
</dependencies>
</metadata>
<files>
<file src="xunit.core\build\xunit.core.props" target="build\portable-net45+wp80+win\xunit.core.props" />
<file src="xunit.core\bin\Release\xunit.core.dll" target="lib\portable-net45+wp80+win\xunit.core.dll" />
<file src="xunit.core\bin\Release\xunit.core.dll.tdnet" target="lib\portable-net45+wp80+win\xunit.core.dll.tdnet" />
<file src="xunit.core\bin\Release\xunit.core.xml" target="lib\portable-net45+wp80+win\xunit.core.xml" />
<file src="xunit.execution\bin\Release\xunit.execution.dll" target="lib\portable-net45+wp80+win\xunit.execution.dll" />
<file src="xunit.runner.tdnet\bin\Release\xunit.runner.tdnet.dll" target="lib\portable-net45+wp80+win\xunit.runner.tdnet.dll" />
<file src="xunit.runner.utility\bin\Release\xunit.runner.utility.dll" target="lib\portable-net45+wp80+win\xunit.runner.utility.dll" />
</files>
</package>

Просмотреть файл

@ -7,7 +7,7 @@ namespace Xunit
/// Used to declare a specific test collection for a test class.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public sealed class CollectionAttribute : AttributeBase
public sealed class CollectionAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="CollectionAttribute" /> class.

Просмотреть файл

Просмотреть файл

@ -8,7 +8,7 @@ namespace Xunit
/// Used to declare a the default test collection behavior for the assembly.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public sealed class CollectionBehaviorAttribute : AttributeBase
public sealed class CollectionBehaviorAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="CollectionBehaviorAttribute" /> class.

Просмотреть файл

@ -11,7 +11,7 @@ namespace Xunit
/// that are members of the test collection.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class CollectionDefinitionAttribute : AttributeBase
public sealed class CollectionDefinitionAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="CollectionDefinitionAttribute" /> class.

Просмотреть файл

@ -9,7 +9,7 @@ namespace Xunit
/// by the test runner. It can also be extended to support a customized definition of a
/// test method.
/// </summary>
[TestCaseDiscoverer("Xunit.Sdk.FactDiscoverer", "xunit2")]
[TestCaseDiscoverer("Xunit.Sdk.FactDiscoverer", "xunit.execution")]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
[SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes", Justification = "This attribute is designed as an extensibility point.")]
public class FactAttribute : Attribute

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -9,7 +9,7 @@ namespace Xunit
/// Provides a data source for a data theory, with the data coming from inline values.
/// </summary>
[CLSCompliant(false)]
[DataDiscoverer("Xunit.Sdk.InlineDataDiscoverer", "xunit2")]
[DataDiscoverer("Xunit.Sdk.InlineDataDiscoverer", "xunit.execution")]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public sealed class InlineDataAttribute : DataAttribute
{

Просмотреть файл

@ -0,0 +1,6 @@
using System;
using System.Reflection;
using System.Security;
[assembly: AssemblyTitle("xUnit.net Core")]
[assembly: CLSCompliant(true)]

Просмотреть файл

@ -38,16 +38,24 @@ namespace Xunit
{
Guard.ArgumentNotNull("methodUnderTest", testMethod);
Type type = PropertyType ?? testMethod.DeclaringType;
PropertyInfo propInfo = type.GetProperty(PropertyName, BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
if (propInfo == null)
throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Could not find public static property {0} on {1}", PropertyName, type.FullName));
var type = PropertyType ?? testMethod.DeclaringType;
PropertyInfo propInfo = null;
for (var reflectionType = type; reflectionType != null; reflectionType = reflectionType.GetTypeInfo().BaseType)
{
propInfo = reflectionType.GetRuntimeProperty(PropertyName);
if (propInfo != null)
break;
}
if (propInfo == null || propInfo.GetMethod == null || !propInfo.GetMethod.IsStatic)
throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Could not find public static get property {0} on {1}", PropertyName, type.FullName));
object obj = propInfo.GetValue(null, null);
if (obj == null)
return null;
IEnumerable<object[]> dataItems = obj as IEnumerable<object[]>;
var dataItems = obj as IEnumerable<object[]>;
if (dataItems == null)
throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Property {0} on {1} did not return IEnumerable<object[]>", PropertyName, type.FullName));

Просмотреть файл

@ -10,8 +10,6 @@ namespace Xunit.Sdk
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public abstract class BeforeAfterTestAttribute : Attribute
{
object typeId = new object();
/// <summary>
/// This method is called after the test method is executed.
/// </summary>
@ -23,11 +21,5 @@ namespace Xunit.Sdk
/// </summary>
/// <param name="methodUnderTest">The method under test</param>
public virtual void Before(MethodInfo methodUnderTest) { }
/// <inheritdoc/>
public override object TypeId
{
get { return typeId; }
}
}
}

Просмотреть файл

@ -9,9 +9,9 @@ namespace Xunit.Sdk
/// Data source providers derive from this attribute and implement GetData
/// to return the data for the theory.
/// </summary>
[DataDiscoverer("Xunit.Sdk.DataDiscoverer", "xunit2")]
[DataDiscoverer("Xunit.Sdk.DataDiscoverer", "xunit.execution")]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public abstract class DataAttribute : AttributeBase
public abstract class DataAttribute : Attribute
{
/// <summary>
/// Returns the data to be used to test the theory.

Просмотреть файл

@ -7,7 +7,7 @@ namespace Xunit.Sdk
/// to indicate how data elements should be discovered.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public sealed class DataDiscovererAttribute : AttributeBase
public sealed class DataDiscovererAttribute : Attribute
{
/// <summary>
/// Initializes an instance of <see cref="DataDiscovererAttribute"/>.
@ -15,7 +15,7 @@ namespace Xunit.Sdk
/// <param name="typeName">The fully qualified type name of the discoverer
/// (f.e., 'Xunit.Sdk.DataDiscoverer')</param>
/// <param name="assemblyName">The name of the assembly that the discoverer type
/// is located in, without file extension (f.e., 'xunit2')</param>
/// is located in, without file extension (f.e., 'xunit.execution')</param>
public DataDiscovererAttribute(string typeName, string assemblyName) { }
}
}

Просмотреть файл

@ -15,7 +15,7 @@ namespace Xunit.Sdk
/// <param name="typeName">The fully qualified type name of the discoverer
/// (f.e., 'Xunit.Sdk.FactDiscoverer')</param>
/// <param name="assemblyName">The name of the assembly that the discoverer type
/// is located in, without file extension (f.e., 'xunit2')</param>
/// is located in, without file extension (f.e., 'xunit.execution')</param>
public TestCaseDiscovererAttribute(string typeName, string assemblyName) { }
}
}

Просмотреть файл

@ -11,7 +11,7 @@ namespace Xunit
/// derive from <see cref="DataAttribute"/> (notably, <see cref="InlineDataAttribute"/> and
/// <see cref="PropertyDataAttribute"/>).
/// </summary>
[TestCaseDiscoverer("Xunit.Sdk.TheoryDiscoverer", "xunit2")]
[TestCaseDiscoverer("Xunit.Sdk.TheoryDiscoverer", "xunit.execution")]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class TheoryAttribute : FactAttribute { }
}

Просмотреть файл

@ -11,7 +11,7 @@ namespace Xunit
// using the discoverer pattern so that it can support Resharper. We may also want to visit the
// issue of supporting 0..n trait values rather than a forced single value pair model that
// we have today.
public sealed class TraitAttribute : AttributeBase
public sealed class TraitAttribute : Attribute
{
/// <summary>
/// Creates a new instance of the <see cref="TraitAttribute"/> class.

Просмотреть файл

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\..\lib\portable-net45+wp80+win\xunit.execution.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</None>
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1B843C0F-8E08-4BA9-8C85-EEAF779A0774}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Xunit</RootNamespace>
<AssemblyName>xunit.core</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\Signing.snk</AssemblyOriginatorKeyFile>
<CodeAnalysisRuleSet>..\xunit.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<WarningLevel>4</WarningLevel>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;XUNIT_CORE_DLL</DefineConstants>
<DocumentationFile>bin\Debug\xunit.core.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;XUNIT_CORE_DLL</DefineConstants>
<DocumentationFile>bin\Release\xunit.core.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\common\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="..\common\Guard.cs">
<Link>Common\Guard.cs</Link>
</Compile>
<Compile Include="..\xunit.assert\Asserts\Sdk\AssertEqualityComparer.cs">
<Link>Sdk\AssertEqualityComparer.cs</Link>
</Compile>
<Compile Include="..\xunit.assert\Asserts\Sdk\AssertEqualityComparerAdapter.cs">
<Link>Sdk\AssertEqualityComparerAdapter.cs</Link>
</Compile>
<Compile Include="CollectionAttribute.cs" />
<Compile Include="CollectionBehavior.cs" />
<Compile Include="CollectionBehaviorAttribute.cs" />
<Compile Include="CollectionDefinitionAttribute.cs" />
<Compile Include="FactAttribute.cs" />
<Compile Include="IClassFixture.cs" />
<Compile Include="ICollectionFixture.cs" />
<Compile Include="InlineDataAttribute.cs" />
<Compile Include="PropertyDataAttribute.cs" />
<Compile Include="Sdk\BeforeAfterTestAttribute.cs" />
<Compile Include="Sdk\DataAttribute.cs" />
<Compile Include="Sdk\DataDiscovererAttribute.cs" />
<Compile Include="Sdk\TestCaseDiscovererAttribute.cs" />
<Compile Include="TestCaseOrdererAttribute.cs" />
<Compile Include="TheoryAttribute.cs" />
<Compile Include="TraitAttribute.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="build\xunit.core.props" />
<None Include="xunit.core.dll.tdnet">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<CodeAnalysisDictionary Include="..\CodeAnalysisDictionary.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\xunit.abstractions\xunit.abstractions.csproj">
<Project>{53012549-d81b-4e40-b626-67c19265aa6f}</Project>
<Name>xunit.abstractions</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

Просмотреть файл

@ -3,5 +3,4 @@ using System.Reflection;
using System.Security;
[assembly: AssemblyTitle("xUnit.net")]
[assembly: AllowPartiallyTrustedCallers]
[assembly: CLSCompliant(true)]

Просмотреть файл

@ -5,7 +5,7 @@ namespace Xunit.Sdk
{
/// <summary>
/// The implementation of <see cref="ITestFramework"/> that supports discovery and
/// execution of unit tests linked against xunit2.dll.
/// execution of unit tests linked against xunit.core.dll, using xunit.execution.dll.
/// </summary>
public class XunitTestFramework : LongLivedMarshalByRefObject, ITestFramework
{

Просмотреть файл

@ -10,7 +10,7 @@ namespace Xunit.Sdk
{
/// <summary>
/// The implementation of <see cref="ITestFrameworkDiscoverer"/> that supports discovery
/// of unit tests linked against xunit2.dll.
/// of unit tests linked against xunit.core.dll, using xunit.execution.dll.
/// </summary>
public class XunitTestFrameworkDiscoverer : LongLivedMarshalByRefObject, ITestFrameworkDiscoverer
{

Просмотреть файл

@ -12,7 +12,7 @@ namespace Xunit.Sdk
{
/// <summary>
/// The implementation of <see cref="ITestFrameworkExecutor"/> that supports execution
/// of unit tests linked against xunit2.dll.
/// of unit tests linked against xunit.core.dll, using xunit.execution.dll.
/// </summary>
public class XunitTestFrameworkExecutor : LongLivedMarshalByRefObject, ITestFrameworkExecutor
{

Просмотреть файл

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше