Filtering out related tests
This commit is contained in:
Родитель
588b7de1b8
Коммит
46d41224f3
|
@ -21,12 +21,15 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<!-- v4 Exclusions -->
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="**\*.!v4.cs" />
|
||||
<Compile Remove="**\*.v5.cs" />
|
||||
<Compile Remove="**\*.v8.cs" />
|
||||
<Compile Remove="**\*.!v4.cs" />
|
||||
<Compile Remove="**\*.v5.cs" />
|
||||
<Compile Remove="**\*.v6.cs" />
|
||||
<Compile Remove="**\*.v7.cs" />
|
||||
<Compile Remove="**\*.v8.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Pattern\Abstractions\Resolvers\ValidatingResolverFactory.cs" />
|
||||
<Compile Remove="Pattern\Abstractions\Resolvers\ValidatintResolver.cs" />
|
||||
<Compile Remove="Pattern\Abstractions\FixtureBase.Fields.cs" />
|
||||
|
|
|
@ -24,12 +24,17 @@
|
|||
|
||||
<ItemGroup>
|
||||
<Compile Remove="**\*.v4.cs" />
|
||||
<Compile Remove="**\*.!v5.cs" />
|
||||
<Compile Remove="**\*.v6.cs" />
|
||||
<Compile Remove="**\*.v7.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" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Pattern\Abstractions\Resolvers\ValidatingResolverFactory.cs" />
|
||||
<Compile Remove="Pattern\Abstractions\Resolvers\ValidatintResolver.cs" />
|
||||
<Compile Remove="Pattern\Dependency\DefaultAttribute.cs" />
|
||||
<Compile Remove="Pattern\Lifetime\LifetimeManager.cs" />
|
||||
<Compile Remove="Registration\Validation\Factory.cs" />
|
||||
<Compile Remove="Registration\BuiltIn\IServiceProvider.cs" />
|
||||
<Compile Remove="Registration\BuiltIn\IUnityContainerAsync.cs" />
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<!-- Unity v6 -->
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFrameworks>net6.0</TargetFrameworks>
|
||||
<UnityContainer>..\Container\src\Unity.Container.csproj</UnityContainer>
|
||||
<DefineConstants>UNITY_V6;$(DefineConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
@ -26,8 +26,13 @@
|
|||
|
||||
<ItemGroup>
|
||||
<Compile Remove="**\*.v4.cs" />
|
||||
<Compile Remove="**\*.v5.cs" />
|
||||
<Compile Remove="**\*.!v6.cs" />
|
||||
<Compile Remove="**\*.v7.cs" />
|
||||
<Compile Remove="**\*.v8.cs" />
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Patterns\Abstractions\Resolvers\ValidatingResolverFactory.cs" />
|
||||
<Compile Remove="Patterns\Abstractions\Resolvers\ValidatintResolver.cs" />
|
||||
<Compile Remove="Patterns\Dependency\DefaultAttribute.cs" />
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
using Unity.Builder;
|
||||
using Unity.Strategies;
|
||||
|
||||
|
||||
namespace Regression.Container
|
||||
{
|
||||
/// <summary>
|
||||
/// Implementation of <see cref="BuilderStrategy"/> which will notify an object about
|
||||
/// the completion of a BuildUp operation.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This strategy checks the object that is passing through the builder chain to see if it
|
||||
/// implements IBuilderAware and if it does, it will call <see cref="IBuilderAware.OnBuiltUp"/>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Starting with Unity v5 this strategy is no longer part of Unity container implementation
|
||||
/// but as demonstrated in this example could be easily added to the container.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public class BuilderAwareStrategy : BuilderStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Called during the chain of responsibility for a build operation. The
|
||||
/// PreBuildUp method is called when the chain is being executed in the
|
||||
/// forward direction.
|
||||
/// </summary>
|
||||
/// <param name="context">Context of the build operation.</param>
|
||||
public override void PreBuildUp(ref BuilderContext context)
|
||||
{
|
||||
if (context.Existing is IBuilderAware aware)
|
||||
aware.OnBuiltUp(context.Type, context.Name);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +1,40 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Regression;
|
||||
using System;
|
||||
using Unity;
|
||||
|
||||
namespace Dependency
|
||||
{
|
||||
public abstract partial class Pattern
|
||||
{
|
||||
// Defaults are not supported in Unity v4
|
||||
#region With Defaults
|
||||
[PatternTestMethod("Dependency with default Value"), TestCategory(CATEGORY_DEPENDENCY)]
|
||||
[DynamicData(nameof(WithDefaultValue_Data))]
|
||||
public virtual void Import_WithDefault_Value(string test, Type type)
|
||||
{
|
||||
// Act
|
||||
var instance = Container.Resolve(type, null) as DependencyBaseType;
|
||||
|
||||
// Validate
|
||||
Assert.IsNotNull(instance);
|
||||
Assert.IsInstanceOfType(instance, type);
|
||||
Assert.AreEqual(instance.Default, instance.Value);
|
||||
|
||||
// Arrange
|
||||
RegisterTypes();
|
||||
|
||||
// Act
|
||||
instance = Container.Resolve(type, null) as DependencyBaseType;
|
||||
|
||||
// Validate
|
||||
Assert.IsNotNull(instance);
|
||||
Assert.IsInstanceOfType(instance, type);
|
||||
#if !BEHAVIOR_V5
|
||||
Assert.AreEqual(Container.Resolve(instance.ImportType, null), instance.Value);
|
||||
#endif
|
||||
}
|
||||
|
||||
[PatternTestMethod("Dependency with DefaultValue attribute"), TestCategory(CATEGORY_DEPENDENCY)]
|
||||
[DynamicData(nameof(WithDefaultAttribute_Data))]
|
||||
/// <summary>
|
||||
|
@ -30,7 +59,10 @@ namespace Dependency
|
|||
// Validate
|
||||
Assert.IsNotNull(instance);
|
||||
Assert.IsInstanceOfType(instance, type);
|
||||
#if !BEHAVIOR_V5
|
||||
|
||||
Assert.AreEqual(Container.Resolve(instance.ImportType, null), instance.Value);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,5 +92,6 @@ namespace Dependency
|
|||
Assert.IsInstanceOfType(instance, type);
|
||||
Assert.AreEqual(Container.Resolve(instance.ImportType, null), instance.Value);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,113 +0,0 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Regression;
|
||||
using System;
|
||||
#if UNITY_V4
|
||||
using Microsoft.Practices.Unity;
|
||||
#else
|
||||
using Unity;
|
||||
#endif
|
||||
|
||||
namespace Dependency
|
||||
{
|
||||
public abstract partial class Pattern
|
||||
{
|
||||
#region With Defaults
|
||||
#if !UNITY_V4 // Defaults are not supported in Unity v4
|
||||
#if BEHAVIOR_V4
|
||||
[ExpectedException(typeof(ResolutionFailedException))]
|
||||
#endif
|
||||
[PatternTestMethod("Dependency with default Value"), TestCategory(CATEGORY_DEPENDENCY)]
|
||||
[DynamicData(nameof(WithDefaultValue_Data))]
|
||||
public virtual void Import_WithDefault_Value(string test, Type type)
|
||||
{
|
||||
// Act
|
||||
var instance = Container.Resolve(type, null) as DependencyBaseType;
|
||||
|
||||
// Validate
|
||||
Assert.IsNotNull(instance);
|
||||
Assert.IsInstanceOfType(instance, type);
|
||||
Assert.AreEqual(instance.Default, instance.Value);
|
||||
|
||||
// Arrange
|
||||
RegisterTypes();
|
||||
|
||||
// Act
|
||||
instance = Container.Resolve(type, null) as DependencyBaseType;
|
||||
|
||||
// Validate
|
||||
Assert.IsNotNull(instance);
|
||||
Assert.IsInstanceOfType(instance, type);
|
||||
#if !BEHAVIOR_V5
|
||||
Assert.AreEqual(Container.Resolve(instance.ImportType, null), instance.Value);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BEHAVIOR_V4 || BEHAVIOR_V5
|
||||
[ExpectedException(typeof(ResolutionFailedException))]
|
||||
#endif
|
||||
[PatternTestMethod("Dependency with DefaultValue attribute"), TestCategory(CATEGORY_DEPENDENCY)]
|
||||
[DynamicData(nameof(WithDefaultAttribute_Data))]
|
||||
/// <summary>
|
||||
/// Tests providing default values
|
||||
/// </summary>
|
||||
public virtual void Import_WithDefault_Attribute(string test, Type type)
|
||||
{
|
||||
// Act
|
||||
var instance = Container.Resolve(type, null) as DependencyBaseType;
|
||||
|
||||
// Validate
|
||||
Assert.IsNotNull(instance);
|
||||
Assert.IsInstanceOfType(instance, type);
|
||||
Assert.AreEqual(instance.Default, instance.Value);
|
||||
|
||||
// Arrange
|
||||
RegisterTypes();
|
||||
|
||||
// Act
|
||||
instance = Container.Resolve(type, null) as DependencyBaseType;
|
||||
|
||||
// Validate
|
||||
Assert.IsNotNull(instance);
|
||||
Assert.IsInstanceOfType(instance, type);
|
||||
#if !BEHAVIOR_V5
|
||||
|
||||
Assert.AreEqual(Container.Resolve(instance.ImportType, null), instance.Value);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if BEHAVIOR_V4
|
||||
[ExpectedException(typeof(ResolutionFailedException))]
|
||||
#endif
|
||||
[PatternTestMethod("Dependency with default Value and Attribute"), TestCategory(CATEGORY_DEPENDENCY)]
|
||||
[DynamicData(nameof(WithDefaultAndAttribute_Data))]
|
||||
/// <summary>
|
||||
/// Tests providing default values
|
||||
/// </summary>
|
||||
public virtual void Import_WithDefault_ValueAndAttribute(string test, Type type)
|
||||
{
|
||||
// Act
|
||||
var instance = Container.Resolve(type, null) as DependencyBaseType;
|
||||
|
||||
// Validate
|
||||
Assert.IsNotNull(instance);
|
||||
Assert.IsInstanceOfType(instance, type);
|
||||
Assert.AreEqual(instance.Default, instance.Value);
|
||||
|
||||
// Arrange
|
||||
RegisterTypes();
|
||||
|
||||
// Act
|
||||
instance = Container.Resolve(type, null) as DependencyBaseType;
|
||||
|
||||
// Validate
|
||||
Assert.IsNotNull(instance);
|
||||
Assert.IsInstanceOfType(instance, type);
|
||||
#if !BEHAVIOR_V5
|
||||
Assert.AreEqual(Container.Resolve(instance.ImportType, null), instance.Value);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -20,5 +20,9 @@ namespace Constructors
|
|||
public static void Resolving_Implicit_Initialize(TestContext context) => Pattern_Initialize(context.FullyQualifiedTestClassName);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Overrides
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,5 +13,4 @@ By default the solution compares container behavior from 4 different releases:
|
|||
|
||||
* [Unity v4.0.1](https://github.com/unitycontainer/unity/tree/release/4.0.x) (.NET 4.6.x)
|
||||
* [Unity v5.11](https://github.com/unitycontainer/unity/releases/tag/5.11.6.966) (.NET 4.7.x)
|
||||
* [Unity v5.12 - beta](https://github.com/unitycontainer/container/tree/release/5.12.0) (.NET 4.8)
|
||||
* [Unity v6.0 - alpha](https://github.com/unitycontainer/container/tree/release/6.0.0) (.NET 5.0)
|
||||
* [Unity v6.0 - alpha](https://github.com/unitycontainer/container/tree/release/6.0.0) (.NET 6.0)
|
||||
|
|
|
@ -24,6 +24,9 @@ namespace Registration
|
|||
Assert.IsNotNull(Container.Resolve<IUnresolvable>());
|
||||
}
|
||||
|
||||
#if BEHAVIOR_V5
|
||||
[Ignore("Known Issue")]
|
||||
#endif
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void RegisterInstance_ThrowsOnNullNull()
|
||||
|
@ -31,6 +34,9 @@ namespace Registration
|
|||
Container.RegisterInstance(null, null, null, new ContainerControlledLifetimeManager());
|
||||
}
|
||||
|
||||
#if BEHAVIOR_V5
|
||||
[Ignore("Known Issue")]
|
||||
#endif
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void RegisterInstance_Null_Null_Null()
|
||||
|
|
|
@ -20,27 +20,19 @@ namespace Registration
|
|||
get
|
||||
{
|
||||
yield return new object[] { typeof(IService), typeof(Service), null, null, typeof(TransientLifetimeManager) };
|
||||
#if !BEHAVIOR_V4
|
||||
yield return new object[] { typeof(Service), typeof(IService), null, null, typeof(TransientLifetimeManager) };
|
||||
#endif
|
||||
yield return new object[] { typeof(object), typeof(object), null, null, typeof(TransientLifetimeManager) };
|
||||
yield return new object[] { null, typeof(object), null, null, typeof(TransientLifetimeManager) };
|
||||
#if !BEHAVIOR_V4
|
||||
yield return new object[] { typeof(object), null, null, null, typeof(TransientLifetimeManager) };
|
||||
#endif
|
||||
yield return new object[] { typeof(object), typeof(object), Name, null, typeof(TransientLifetimeManager) };
|
||||
yield return new object[] { null, typeof(object), Name, null, typeof(TransientLifetimeManager) };
|
||||
#if !BEHAVIOR_V4
|
||||
yield return new object[] { typeof(object), null, Name, null, typeof(TransientLifetimeManager) };
|
||||
#endif
|
||||
yield return new object[] { typeof(object), typeof(object), null, new ContainerControlledLifetimeManager(), typeof(ContainerControlledLifetimeManager) };
|
||||
yield return new object[] { null, typeof(object), null, new ContainerControlledLifetimeManager(), typeof(ContainerControlledLifetimeManager) };
|
||||
#if !BEHAVIOR_V4
|
||||
yield return new object[] { typeof(object), null, null, new ContainerControlledLifetimeManager(), typeof(ContainerControlledLifetimeManager) };
|
||||
#endif
|
||||
yield return new object[] { typeof(object), typeof(object), Name, new ContainerControlledLifetimeManager(), typeof(ContainerControlledLifetimeManager) };
|
||||
yield return new object[] { null, typeof(object), Name, new ContainerControlledLifetimeManager(), typeof(ContainerControlledLifetimeManager) };
|
||||
#if !BEHAVIOR_V4
|
||||
#if !BEHAVIOR_V4 // && !BEHAVIOR_V5
|
||||
yield return new object[] { typeof(Service), typeof(IService), null, null, typeof(TransientLifetimeManager) };
|
||||
yield return new object[] { typeof(object), null, null, null, typeof(TransientLifetimeManager) };
|
||||
yield return new object[] { typeof(object), null, Name, null, typeof(TransientLifetimeManager) };
|
||||
yield return new object[] { typeof(object), null, null, new ContainerControlledLifetimeManager(), typeof(ContainerControlledLifetimeManager) };
|
||||
yield return new object[] { typeof(object), null, Name, new ContainerControlledLifetimeManager(), typeof(ContainerControlledLifetimeManager) };
|
||||
#endif
|
||||
}
|
||||
|
@ -50,7 +42,7 @@ namespace Registration
|
|||
{
|
||||
get
|
||||
{
|
||||
#if BEHAVIOR_V4
|
||||
#if BEHAVIOR_V4 // || BEHAVIOR_V5
|
||||
yield return new object[] { typeof(ArgumentException), typeof(Service), typeof(IService), null, new TransientLifetimeManager(), null };
|
||||
yield return new object[] { typeof(ArgumentException), typeof(object), null, null, new TransientLifetimeManager(), null };
|
||||
yield return new object[] { typeof(ArgumentException), typeof(object), null, Name, new TransientLifetimeManager(), null };
|
||||
|
|
Загрузка…
Ссылка в новой задаче