From 0f6da1873e9c3aeb54aa6cab2292cd75d672f6d6 Mon Sep 17 00:00:00 2001 From: ta264 Date: Sun, 8 Sep 2019 21:08:04 +0100 Subject: [PATCH] Update unity --- src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs | 3 ++- .../Unity/AutoMockingBuilderStrategy.cs | 18 ++++++++---------- .../Unity/AutoMockingContainerExtension.cs | 6 +++--- .../Sonarr.Test.Common.csproj | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs b/src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs index f3c03c93c..5c02ae197 100644 --- a/src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs +++ b/src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs @@ -6,11 +6,12 @@ using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; -using Microsoft.Practices.Unity; +using Unity; using Moq; using Moq.Language.Flow; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Test.Common.AutoMoq.Unity; +using Unity.Resolution; [assembly: InternalsVisibleTo("AutoMoq.Tests")] diff --git a/src/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs b/src/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs index b586a3416..5fbb18d32 100644 --- a/src/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs +++ b/src/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs @@ -1,12 +1,11 @@ - - -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; -using Microsoft.Practices.ObjectBuilder2; -using Microsoft.Practices.Unity; +using Unity; using Moq; +using Unity.Strategies; +using Unity.Builder; namespace NzbDrone.Test.Common.AutoMoq.Unity { @@ -24,7 +23,7 @@ namespace NzbDrone.Test.Common.AutoMoq.Unity _container = container; } - public override void PreBuildUp(IBuilderContext context) + public override void PreBuildUp(ref BuilderContext context) { var autoMoqer = _container.Resolve(); @@ -43,12 +42,11 @@ namespace NzbDrone.Test.Common.AutoMoq.Unity { var mocker = _container.Resolve(); return TypeIsNotRegistered(type) && (mocker.ResolveType == null || mocker.ResolveType != type); - //return TypeIsNotRegistered(type) && type.IsInterface; } - private static Type GetTheTypeFromTheBuilderContext(IBuilderContext context) + private static Type GetTheTypeFromTheBuilderContext(BuilderContext context) { - return (context.OriginalBuildKey).Type; + return context.Type; } private bool TypeIsNotRegistered(Type type) @@ -82,4 +80,4 @@ namespace NzbDrone.Test.Common.AutoMoq.Unity #endregion } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs b/src/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs index 9c6170ce6..b764c929d 100644 --- a/src/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs +++ b/src/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -using Microsoft.Practices.Unity; -using Microsoft.Practices.Unity.ObjectBuilder; +using Unity.Builder; +using Unity.Extension; namespace NzbDrone.Test.Common.AutoMoq.Unity { @@ -36,4 +36,4 @@ namespace NzbDrone.Test.Common.AutoMoq.Unity #endregion } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Test.Common/Sonarr.Test.Common.csproj b/src/NzbDrone.Test.Common/Sonarr.Test.Common.csproj index f60082606..d97735dfb 100644 --- a/src/NzbDrone.Test.Common/Sonarr.Test.Common.csproj +++ b/src/NzbDrone.Test.Common/Sonarr.Test.Common.csproj @@ -10,7 +10,7 @@ - +