Moving files
This commit is contained in:
Родитель
7aa30a2a9a
Коммит
78665da5ac
|
@ -0,0 +1,66 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<!-- Unity v4 -->
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<DefineConstants>UNITY_V4;$(DefineConstants)</DefineConstants>
|
||||||
|
<UnityContainer>..\..\unity\source\Unity\Src\Unity.csproj</UnityContainer>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Condition="Exists('$(UnityContainer)') " Include="$(UnityContainer)" />
|
||||||
|
<PackageReference Condition="!Exists('$(UnityContainer)')" Include="Unity" Version="4.0.1" />
|
||||||
|
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Configuration Settings -->
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<DefineConstants Condition="'$(Configuration)'=='v4'">$(DefineConstants);BEHAVIOR_V4</DefineConstants>
|
||||||
|
<DefineConstants Condition="'$(Configuration)'=='Release'">$(DefineConstants);BEHAVIOR_V4</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- v4 Exclusions -->
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="**\*.!v4.cs" />
|
||||||
|
<Compile Remove="**\*.v5.cs" />
|
||||||
|
<Compile Remove="**\*.v8.cs" />
|
||||||
|
|
||||||
|
<Compile Remove="Patterns\Abstractions\Resolvers\ValidatingResolverFactory.cs" />
|
||||||
|
<Compile Remove="Patterns\Abstractions\Resolvers\ValidatintResolver.cs" />
|
||||||
|
<Compile Remove="Patterns\Abstractions\FixtureBase.Fields.cs" />
|
||||||
|
<Compile Remove="Patterns\Abstractions\Data\Fields\**" />
|
||||||
|
<Compile Remove="Patterns\Dependency\DefaultValue.cs" />
|
||||||
|
<Compile Remove="Patterns\Dependency\DefaultAttribute.cs" />
|
||||||
|
<Compile Remove="Patterns\Dependency\Data\Fields\**" />
|
||||||
|
<Compile Remove="Patterns\Dependency\Implementation\Fields\**" />
|
||||||
|
<Compile Remove="Patterns\Injection\Implementation\Fields\**" />
|
||||||
|
<Compile Remove="Patterns\Injection\Data\Fields\**" />
|
||||||
|
<Compile Remove="Patterns\Injection\Annotation\Overrides\Dependency.Import.cs" />
|
||||||
|
<Compile Remove="Patterns\Injection\Annotation\Overrides\OptionalParameter.cs" />
|
||||||
|
<Compile Remove="Patterns\Injection\Annotation\Overrides\ResolvedParameter.cs" />
|
||||||
|
<Compile Remove="Patterns\Injection\Override\Dependency.Injected.!v4.cs" />
|
||||||
|
<Compile Remove="Patterns\Lifetime\LifetimeManager.cs" />
|
||||||
|
<Compile Remove="Patterns\Lifetime\LifetimeManager\Disposable.cs" />
|
||||||
|
<Compile Remove="Patterns\Selection\Implementation\Fields\Annotated.cs" />
|
||||||
|
<Compile Remove="Patterns\Selection\Implementation\Fields.cs" />
|
||||||
|
<Compile Remove="Resolution\Enumerable\**" />
|
||||||
|
<Compile Remove="Resolution\Generic\Constrained.cs" />
|
||||||
|
<Compile Remove="Registration\Validation\Factory.cs" />
|
||||||
|
<Compile Remove="Registration\BuiltIn\IServiceProvider.cs" />
|
||||||
|
<Compile Remove="Registration\BuiltIn\IUnityContainerAsync.cs" />
|
||||||
|
<Compile Remove="Container\Extension\BuilderAware\BuilderAwareStrategy.cs" />
|
||||||
|
<Compile Remove="Container\Extension\BuilderAware\IBuilderAware.cs" />
|
||||||
|
<Compile Remove="Registration\Validation\Factory.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Using Remove="System.Net.Http" />
|
||||||
|
<None Remove=".git" />
|
||||||
|
<None Remove=".gitignore" />
|
||||||
|
<None Remove="*.slnf" />
|
||||||
|
<None Remove="*.props" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -0,0 +1,48 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<!-- Unity v5 -->
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<UnityContainer>..\Container\src\Unity.Container.csproj</UnityContainer>
|
||||||
|
<DefineConstants>UNITY_V5;$(DefineConstants)</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Condition="Exists('$(UnityContainer)') " Include="$(UnityContainer)" />
|
||||||
|
<PackageReference Condition="!Exists('$(UnityContainer)')" Include="Unity.Container" Version="5.11.*" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Configuration Settings -->
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<DefineConstants Condition="'$(Configuration)'=='v5'">$(DefineConstants);BEHAVIOR_V5</DefineConstants>
|
||||||
|
<DefineConstants Condition="'$(Configuration)'=='Release'">$(DefineConstants);BEHAVIOR_V5</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- v5 Exclusions -->
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="**\*.v4.cs" />
|
||||||
|
<Compile Remove="**\*.v8.cs" />
|
||||||
|
|
||||||
|
<Compile Remove="Patterns\Abstractions\Resolvers\ValidatingResolverFactory.cs" />
|
||||||
|
<Compile Remove="Patterns\Abstractions\Resolvers\ValidatintResolver.cs" />
|
||||||
|
<Compile Remove="Patterns\Dependency\DefaultAttribute.cs" />
|
||||||
|
<Compile Remove="Patterns\Lifetime\LifetimeManager.cs" />
|
||||||
|
<Compile Remove="Registration\Validation\Factory.cs" />
|
||||||
|
<Compile Remove="Registration\BuiltIn\IServiceProvider.cs" />
|
||||||
|
<Compile Remove="Registration\BuiltIn\IUnityContainerAsync.cs" />
|
||||||
|
<Compile Remove="Registration\Validation\Factory.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Using Remove="System.Net.Http" />
|
||||||
|
<None Remove=".git" />
|
||||||
|
<None Remove=".gitignore" />
|
||||||
|
<None Remove="*.slnf" />
|
||||||
|
<None Remove="*.props" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -0,0 +1,50 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<!-- Unity v6 -->
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<UnityContainer>..\Container\src\Unity.Container.csproj</UnityContainer>
|
||||||
|
<DefineConstants>UNITY_V6;$(DefineConstants)</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Condition="Exists('$(UnityContainer)') " Include="$(UnityContainer)" />
|
||||||
|
<PackageReference Condition="!Exists('$(UnityContainer)')" Include="Unity.Container" Version="6.0.*-*" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Configuration Settings -->
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<DefineConstants Condition="'$(Configuration)'=='v6'">$(DefineConstants);BEHAVIOR_V6</DefineConstants>
|
||||||
|
<DefineConstants Condition="'$(Configuration)'=='Release'">$(DefineConstants);BEHAVIOR_V6</DefineConstants>
|
||||||
|
<DefineConstants Condition="'$(Configuration)'=='Debug'">$(DefineConstants);BEHAVIOR_V6</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- v6 Exclusions -->
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="**\*.v4.cs" />
|
||||||
|
<Compile Remove="**\*.v8.cs" />
|
||||||
|
|
||||||
|
<Compile Remove="Patterns\Abstractions\Resolvers\ValidatingResolverFactory.cs" />
|
||||||
|
<Compile Remove="Patterns\Abstractions\Resolvers\ValidatintResolver.cs" />
|
||||||
|
<Compile Remove="Patterns\Dependency\DefaultAttribute.cs" />
|
||||||
|
<Compile Remove="Patterns\Lifetime\LifetimeManager.cs" />
|
||||||
|
<Compile Remove="Registration\Validation\Factory.cs" />
|
||||||
|
<Compile Remove="Registration\BuiltIn\IServiceProvider.cs" />
|
||||||
|
<Compile Remove="Registration\BuiltIn\IUnityContainerAsync.cs" />
|
||||||
|
<Compile Remove="Registration\Validation\Factory.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Using Remove="System.Net.Http" />
|
||||||
|
<None Remove=".git" />
|
||||||
|
<None Remove=".gitignore" />
|
||||||
|
<None Remove="*.slnf" />
|
||||||
|
<None Remove="*.props" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -0,0 +1,71 @@
|
||||||
|
// Version
|
||||||
|
|
||||||
|
#if UNITY_V4
|
||||||
|
// Unity v4.0.1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UNITY_V5
|
||||||
|
// Unity v5.x
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UNITY_V6
|
||||||
|
// Unity v6.x
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// Behavior
|
||||||
|
|
||||||
|
#if BEHAVIOR_V4
|
||||||
|
// Unity v4.0.1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BEHAVIOR_V5
|
||||||
|
// Unity v5.11.x
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BEHAVIOR_V6
|
||||||
|
// v6.x
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// .NET Framework
|
||||||
|
|
||||||
|
#if NET5_0
|
||||||
|
// Current Framework NET5.0
|
||||||
|
#endif
|
||||||
|
#if NET48
|
||||||
|
// Current Framework NET4.8
|
||||||
|
#endif
|
||||||
|
#if NET47
|
||||||
|
// Current Framework NET4.7
|
||||||
|
#endif
|
||||||
|
#if NET471
|
||||||
|
// Current Framework NET4.7.1
|
||||||
|
#endif
|
||||||
|
#if NET472
|
||||||
|
// Current Framework NET4.7.2
|
||||||
|
#endif
|
||||||
|
#if NET46
|
||||||
|
// Current Framework NET4.6
|
||||||
|
#endif
|
||||||
|
#if NET461
|
||||||
|
// Current Framework NET4.6.1
|
||||||
|
#endif
|
||||||
|
#if NET462
|
||||||
|
// Current Framework NET4.6.2
|
||||||
|
#endif
|
||||||
|
#if NET45
|
||||||
|
// Current Framework NET4.5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BEHAVIOR_ACTIVATED
|
||||||
|
// BEHAVIOR_ACTIVATED
|
||||||
|
#elif BEHAVIOR_RESOLVED
|
||||||
|
// BEHAVIOR_RESOLVED
|
||||||
|
#elif BEHAVIOR_COMPILED
|
||||||
|
// BEHAVIOR_COMPILED
|
||||||
|
#else
|
||||||
|
// DEFAULT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using Unity.Regression.Tests;
|
||||||
|
#if NET45
|
||||||
|
using Microsoft.Practices.ObjectBuilder2;
|
||||||
|
using Microsoft.Practices.Unity;
|
||||||
|
#else
|
||||||
|
using Unity;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace Container.Extending
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public partial class ExtensionContextTests
|
||||||
|
{
|
||||||
|
ExtensionContext context;
|
||||||
|
UnityContainer container;
|
||||||
|
|
||||||
|
[TestInitialize]
|
||||||
|
public void TestInitialize()
|
||||||
|
{
|
||||||
|
container = new UnityContainer();
|
||||||
|
var mock = new MockContainerExtension();
|
||||||
|
container.AddExtension(mock);
|
||||||
|
context = ((IMockConfiguration)mock).Context;
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void BaselineTest() => Assert.IsNotNull(context);
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void ContainerTest()
|
||||||
|
{
|
||||||
|
// Validate
|
||||||
|
Assert.IsNotNull(context.Container);
|
||||||
|
Assert.IsInstanceOfType(context.Container, typeof(UnityContainer));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void PoliciesTest()
|
||||||
|
{
|
||||||
|
// Validate
|
||||||
|
Assert.IsNotNull(context.Policies);
|
||||||
|
Assert.IsInstanceOfType(context.Policies, typeof(IPolicyList));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
using Microsoft.Practices.Unity;
|
||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using Unity.Regression.Tests;
|
||||||
|
|
||||||
|
namespace Container.Extending
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class UnityExtensionTests
|
||||||
|
{
|
||||||
|
UnityContainer container;
|
||||||
|
MockContainerExtension mock;
|
||||||
|
OtherContainerExtension other;
|
||||||
|
DerivedContainerExtension derived;
|
||||||
|
|
||||||
|
[TestInitialize]
|
||||||
|
public void TestInitialize()
|
||||||
|
{
|
||||||
|
container = new UnityContainer();
|
||||||
|
mock = new MockContainerExtension();
|
||||||
|
other = new OtherContainerExtension();
|
||||||
|
derived = new DerivedContainerExtension();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void AddExtensionTest()
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
container.AddExtension(mock)
|
||||||
|
.AddExtension(other)
|
||||||
|
.AddExtension(derived);
|
||||||
|
|
||||||
|
// Validate
|
||||||
|
Assert.IsTrue(mock.InitializeWasCalled);
|
||||||
|
Assert.IsTrue(other.InitializeWasCalled);
|
||||||
|
Assert.IsTrue(derived.InitializeWasCalled);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void ConfigureTest()
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
container.AddExtension(mock)
|
||||||
|
.AddExtension(other)
|
||||||
|
.AddExtension(derived);
|
||||||
|
|
||||||
|
// Validate
|
||||||
|
Assert.AreSame(derived, container.Configure(typeof(DerivedContainerExtension)));
|
||||||
|
Assert.AreSame(other, container.Configure(typeof(OtherContainerExtension)));
|
||||||
|
Assert.AreSame(mock, container.Configure(typeof(MockContainerExtension)));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void ConfigureGenericTest()
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
container.AddExtension(mock)
|
||||||
|
.AddExtension(other)
|
||||||
|
.AddExtension(derived);
|
||||||
|
|
||||||
|
// Validate
|
||||||
|
Assert.AreSame(derived, container.Configure<DerivedContainerExtension>());
|
||||||
|
Assert.AreSame(other, container.Configure<OtherContainerExtension>());
|
||||||
|
Assert.AreSame(mock, container.Configure<MockContainerExtension>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void AddExtensionGenericTest()
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
container.AddNewExtension<MockContainerExtension>()
|
||||||
|
.AddNewExtension<OtherContainerExtension>()
|
||||||
|
.AddNewExtension<DerivedContainerExtension>();
|
||||||
|
|
||||||
|
// Validate
|
||||||
|
Assert.IsTrue(container.Configure<MockContainerExtension>().InitializeWasCalled);
|
||||||
|
Assert.IsTrue(container.Configure<OtherContainerExtension>().InitializeWasCalled);
|
||||||
|
Assert.IsTrue(container.Configure<DerivedContainerExtension>().InitializeWasCalled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
#if NET45
|
||||||
|
using Microsoft.Practices.Unity;
|
||||||
|
#else
|
||||||
|
using Unity;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace Unity.Regression.Tests
|
||||||
|
{
|
||||||
|
public interface IMockConfiguration : IUnityContainerExtensionConfigurator
|
||||||
|
{
|
||||||
|
ExtensionContext Context { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IOtherConfiguration : IMockConfiguration
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public class MockContainerExtension : UnityContainerExtension, IMockConfiguration
|
||||||
|
{
|
||||||
|
public bool InitializeWasCalled { get; private set; } = false;
|
||||||
|
|
||||||
|
ExtensionContext IMockConfiguration.Context => base.Context;
|
||||||
|
|
||||||
|
protected override void Initialize() => InitializeWasCalled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DerivedContainerExtension : MockContainerExtension
|
||||||
|
{}
|
||||||
|
|
||||||
|
public class OtherContainerExtension : UnityContainerExtension, IOtherConfiguration
|
||||||
|
{
|
||||||
|
public bool InitializeWasCalled { get; private set; } = false;
|
||||||
|
|
||||||
|
ExtensionContext IMockConfiguration.Context => base.Context;
|
||||||
|
|
||||||
|
protected override void Initialize() => this.InitializeWasCalled = true;
|
||||||
|
}
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче