This commit is contained in:
ENikS 2023-03-14 09:25:25 -07:00
Родитель 2704352bfe
Коммит 862e6a6fff
196 изменённых файлов: 232 добавлений и 286 удалений

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

@ -36,7 +36,7 @@
</ItemGroup>
<ItemGroup>
<Compile Remove="Pattern\Abstractions\Resolvers\ValidatingResolverFactory.cs" />
<Compile Remove="Pattern\Abstractions\Abstractions\Resolvers\ValidatingResolverFactory.cs" />
</ItemGroup>
<ItemGroup>

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

@ -11,7 +11,7 @@ using Unity.Lifetime;
namespace Container
{
public partial class Basics
public partial class Hierarchies
{
[PatternTestMethod("IUnityContainer Resolves Itself"), TestCategory(nameof(IUnityContainer))]
public void IUnityContainer_Itself()

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

@ -9,7 +9,7 @@ using Unity.Injection;
namespace Container
{
public abstract partial class Pattern
public partial class Hierarchies
{
#region Baseline Test Type

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

@ -9,7 +9,7 @@ using Unity;
namespace Container
{
public partial class Pattern
public partial class Hierarchies
{
[TestMethod("A dependency on the container is injected")]
[DynamicData(nameof(Hierarchy_Test_Data)), TestProperty(IMPORTING, nameof(IUnityContainer))]

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

@ -9,7 +9,7 @@ using Unity;
namespace Container
{
public partial class Pattern
public partial class Hierarchies
{
[TestMethod("Resolve in child using parent registration")]
[DynamicData(nameof(Hierarchy_Test_Data)), TestCategory(HIERARCHY)]

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

@ -1,16 +1,18 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Regression;
using System;
using System.Collections.Generic;
#if UNITY_V4
using Microsoft.Practices.Unity;
#else
using Unity;
#endif
namespace Container
{
[TestClass]
public partial class Basics : PatternBase
public partial class Hierarchies : PatternBase
{
#region Scaffolding
@ -23,6 +25,7 @@ namespace Container
#endregion
#region Test Data
public class IUnityContainerInjectionClass
@ -65,6 +68,159 @@ namespace Container
}
#pragma warning restore CA1063 // Implement IDisposable Correctly
interface ISingletonService : IDisposable
{
long ContainerId { get; }
bool IsDisposed { get; }
}
interface ISingletonServiceWithDependency : ISingletonService
{
ITestElement Element { get; }
}
interface ISingletonServiceWithFactory : ISingletonService
{
IEnumerable<ITestElement> GetElements();
}
interface ISingletonConsumer : IDisposable
{
long ContainerId { get; }
bool IsDisposed { get; }
ISingletonService SingletonService { get; }
}
interface ITestElement : IDisposable
{
long ContainerId { get; }
bool IsDisposed { get; }
}
interface ITestElementFactory
{
ITestElement CreateElement();
}
class SingletonService : ISingletonService
{
public long ContainerId { get; }
public bool IsDisposed { get; private set; }
public SingletonService(IUnityContainer container)
{
ContainerId = container.GetHashCode();
}
public void Dispose()
{
IsDisposed = true;
}
}
class SingletonServiceWithFactory : ISingletonServiceWithFactory
{
private readonly ITestElementFactory _elementFactory;
public long ContainerId { get; }
public bool IsDisposed { get; private set; }
public SingletonServiceWithFactory(IUnityContainer container, ITestElementFactory factory)
{
ContainerId = container.GetHashCode();
_elementFactory = factory;
}
public IEnumerable<ITestElement> GetElements()
{
for (int i = 0; i < 10; i++)
yield return _elementFactory.CreateElement();
}
public void Dispose()
{
IsDisposed = true;
}
}
class SingletonServiceWithDependency : ISingletonServiceWithDependency
{
public long ContainerId { get; }
public ITestElement Element { get; }
public bool IsDisposed { get; private set; }
public SingletonServiceWithDependency(IUnityContainer container, ITestElement element)
{
ContainerId = container.GetHashCode();
Element = element;
}
public void Dispose()
{
IsDisposed = true;
}
}
class SingletonConsumer : ISingletonConsumer
{
public long ContainerId { get; }
public bool IsDisposed { get; private set; }
public ISingletonService SingletonService { get; }
public SingletonConsumer(IUnityContainer container, ISingletonService singleton)
{
ContainerId = container.GetHashCode();
SingletonService = singleton;
}
public void Dispose()
{
IsDisposed = true;
}
}
class TestElement : ITestElement
{
public long ContainerId { get; }
public bool IsDisposed { get; private set; }
public TestElement(IUnityContainer container)
{
ContainerId = container.GetHashCode();
}
public void Dispose()
{
IsDisposed = true;
}
}
class TestElementFactory : ITestElementFactory
{
private readonly IUnityContainer _container;
public TestElementFactory(IUnityContainer container)
{
_container = container;
}
public ITestElement CreateElement()
{
return _container.Resolve<ITestElement>();
}
}
#endregion
}
}

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

@ -9,9 +9,9 @@ using Unity;
using Unity.Lifetime;
#endif
namespace Lifetime.Manager
namespace Lifetime
{
public abstract partial class Pattern
public partial class Containers
{
[DynamicData(nameof(Child_Scope_Data))]
[PatternTestMethod("Child Container"), TestCategory(CHILD_SCOPE)]

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

@ -10,9 +10,9 @@ using Unity;
using Unity.Lifetime;
#endif
namespace Lifetime.Manager
namespace Lifetime
{
public abstract partial class Pattern
public partial class Containers
{
#if BEHAVIOR_V5
[Ignore("Known Issue")]

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

@ -11,9 +11,9 @@ using Unity;
using Unity.Lifetime;
#endif
namespace Lifetime.Manager
namespace Lifetime
{
public abstract partial class Pattern
public partial class Containers
{
[DynamicData(nameof(Lifetime_Managers_Data), typeof(Lifetime.Pattern))]
[DataTestMethod, TestCategory(LIFETIME_MANAGER)]

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

@ -9,9 +9,9 @@ using Unity;
using Unity.Lifetime;
#endif
namespace Lifetime.Manager
namespace Lifetime
{
public abstract partial class Pattern
public partial class Containers
{
[DynamicData(nameof(Same_Scope_Data))]
[PatternTestMethod("Same Container"), TestCategory(SAME_SCOPE)]

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

@ -1,14 +1,24 @@
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using System.Linq;
#if UNITY_V4
using Microsoft.Practices.Unity;
#else
#endif
namespace Lifetime.Manager
namespace Lifetime
{
public abstract partial class Pattern : Lifetime.Pattern
[TestClass]
public partial class Containers : Lifetime.Pattern
{
#region Scaffolding
[TestInitialize]
public override void TestInitialize() => base.TestInitialize();
#endregion
#region Test Data
public static IEnumerable<object[]> Set_Value_Data

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

@ -9,9 +9,9 @@ using Unity;
using Unity.Lifetime;
#endif
namespace Lifetime.Manager
namespace Lifetime
{
public abstract partial class Pattern
public partial class Containers
{
[DynamicData(nameof(Sibling_Scopes_Data))]
[PatternTestMethod("Two Child Containers"), TestCategory(SIBLING_SCOPES)]

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

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

@ -9,9 +9,9 @@ using Unity;
using Unity.Lifetime;
#endif
namespace Lifetime.Hierarchies
namespace Lifetime
{
public abstract partial class Pattern
public partial class Hierarchies
{
#region Direct

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

@ -9,9 +9,9 @@ using Unity;
using Unity.Lifetime;
#endif
namespace Lifetime.Hierarchies
namespace Lifetime
{
public abstract partial class Pattern
public partial class Hierarchies
{
protected const string DISPOSE_NAME_FORMAT = "Setup in {0}, imported in {1}, {2} is {4}";

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

@ -8,9 +8,9 @@ using Unity;
using Unity.Lifetime;
#endif
namespace Lifetime.Hierarchies
namespace Lifetime
{
public abstract partial class Pattern
public partial class Hierarchies
{
#region Generic Direct

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

@ -9,9 +9,9 @@ using Unity;
using Unity.Lifetime;
#endif
namespace Lifetime.Hierarchies
namespace Lifetime
{
public abstract partial class Pattern
public partial class Hierarchies
{
#region Registered Singleton

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

@ -9,9 +9,9 @@ using Unity;
using Unity.Lifetime;
#endif
namespace Lifetime.Hierarchies
namespace Lifetime
{
public abstract partial class Pattern
public partial class Hierarchies
{
#region Registered Singleton

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

@ -7,10 +7,21 @@ using Microsoft.Practices.Unity;
using Unity;
#endif
namespace Lifetime.Hierarchies
namespace Lifetime
{
public abstract partial class Pattern : Lifetime.Pattern
[TestClass]
public partial class Hierarchies : Lifetime.Pattern
{
#region Scaffolding
[TestInitialize]
public override void TestInitialize() => base.TestInitialize();
#endregion
#region Constants
protected const string REGISTRATION_NONE = "Unregistered";

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

@ -1,15 +1,10 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
#if UNITY_V4
using Microsoft.Practices.Unity;
#else
using Unity;
using Unity.Lifetime;
#endif
namespace Lifetime
{
[TestClass]
public class Containers : Lifetime.Manager.Pattern
public partial class Managers : Lifetime.Pattern
{
#region Scaffolding
@ -17,5 +12,7 @@ namespace Lifetime
public override void TestInitialize() => base.TestInitialize();
#endregion
}
}

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

@ -0,0 +1,11 @@
using System.Collections.Generic;
using System;
namespace Lifetime
{
public partial class Managers
{
}
}

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

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

@ -6,9 +6,9 @@ using Microsoft.Practices.Unity;
using Unity.Lifetime;
#endif
namespace Lifetime.Synchronization
namespace Lifetime
{
public abstract partial class Pattern
public partial class Synchronized
{
#if BEHAVIOR_V4 || BEHAVIOR_V5
[Ignore("Known Issue")]

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

@ -1,15 +1,11 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
#if UNITY_V4
using Microsoft.Practices.Unity;
#else
using Unity;
using Unity.Lifetime;
#endif
namespace Lifetime
{
[TestClass]
public class Synchronized : Lifetime.Synchronization.Pattern
public partial class Synchronized : Lifetime.Pattern
{
#region Scaffolding
@ -17,5 +13,7 @@ namespace Lifetime
public override void TestInitialize() => base.TestInitialize();
#endregion
}
}

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

@ -10,9 +10,9 @@ using Microsoft.Practices.Unity;
using Unity.Lifetime;
#endif
namespace Lifetime.Synchronization
namespace Lifetime
{
public abstract partial class Pattern
public partial class Synchronized
{
#if !UNITY_V4 && !UNITY_V5 && !UNITY_V6 && !UNITY_V7
[PatternTestMethod("SynchronizedManager.GetValue(...) blocks"), TestCategory(LIFETIME_MANAGER)]

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

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

@ -1,7 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Regression;
using System;
using Unity;
namespace Dependency
{

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

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

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