diff --git a/src/BBT.StructureTools.Tests/BBT.StructureTools.Tests.csproj b/src/BBT.StructureTools.Tests/BBT.StructureTools.Tests.csproj index 5ab6eb0..0b62d00 100644 --- a/src/BBT.StructureTools.Tests/BBT.StructureTools.Tests.csproj +++ b/src/BBT.StructureTools.Tests/BBT.StructureTools.Tests.csproj @@ -23,6 +23,7 @@ + diff --git a/src/BBT.StructureTools.Tests/Compare/ComparerWithObjectAttributeTests.cs b/src/BBT.StructureTools.Tests/Compare/ComparerWithObjectAttributeTests.cs index 194e793..fb9cc93 100644 --- a/src/BBT.StructureTools.Tests/Compare/ComparerWithObjectAttributeTests.cs +++ b/src/BBT.StructureTools.Tests/Compare/ComparerWithObjectAttributeTests.cs @@ -5,7 +5,7 @@ using BBT.StructureTools.Compare.Exclusions; using BBT.StructureTools.Compare.Helper; using BBT.StructureTools.Tests.Compare.Intention; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; @@ -13,18 +13,19 @@ /// Test for Comparer infrastructure with object attributes. /// [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class ComparerWithObjectAttributeTests { #region Members, Setup private readonly IComparer testcandidate; - public ComparerWithObjectAttributeTests() + public ComparerWithObjectAttributeTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton, TestClassCompareRegistrations>(); + iocContainer.RegisterSingleton, TestClassCompareRegistrations>(); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } #endregion diff --git a/src/BBT.StructureTools.Tests/Compare/ComparerWithObjectAttributeWithDistinguishedComparerIntTests.cs b/src/BBT.StructureTools.Tests/Compare/ComparerWithObjectAttributeWithDistinguishedComparerIntTests.cs index c9fbd1d..97e432e 100644 --- a/src/BBT.StructureTools.Tests/Compare/ComparerWithObjectAttributeWithDistinguishedComparerIntTests.cs +++ b/src/BBT.StructureTools.Tests/Compare/ComparerWithObjectAttributeWithDistinguishedComparerIntTests.cs @@ -6,11 +6,12 @@ using BBT.StructureTools.Compare.Exclusions; using BBT.StructureTools.Compare.Helper; using BBT.StructureTools.Tests.Compare.Intention; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class ComparerWithObjectAttributeWithDistinguishedComparerIntTests { #region Members, Setup @@ -18,15 +19,15 @@ public class ComparerWithObjectAttributeWithDistinguishedComparerIntTests private static IComparer distinguishedComparer; private readonly IComparer testcandidate; - public ComparerWithObjectAttributeWithDistinguishedComparerIntTests() + public ComparerWithObjectAttributeWithDistinguishedComparerIntTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton, TestClassCompareRegistrations>(); - kernel.RegisterSingleton, TestAttributeCompareRegistrations>(); + iocContainer.RegisterSingleton, TestClassCompareRegistrations>(); + iocContainer.RegisterSingleton, TestAttributeCompareRegistrations>(); - distinguishedComparer = kernel.GetInstance>(); - this.testcandidate = kernel.GetInstance>(); + distinguishedComparer = iocContainer.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } #endregion diff --git a/src/BBT.StructureTools.Tests/Compare/ComparerWithObjectsAndValueAttributesTests.cs b/src/BBT.StructureTools.Tests/Compare/ComparerWithObjectsAndValueAttributesTests.cs index 8e120e4..09b1c1e 100644 --- a/src/BBT.StructureTools.Tests/Compare/ComparerWithObjectsAndValueAttributesTests.cs +++ b/src/BBT.StructureTools.Tests/Compare/ComparerWithObjectsAndValueAttributesTests.cs @@ -6,22 +6,24 @@ using BBT.StructureTools.Compare.Exclusions; using BBT.StructureTools.Compare.Helper; using BBT.StructureTools.Tests.Compare.Intention; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class ComparerWithObjectsAndValueAttributesTests { #region Members, Setup private readonly IComparer testcandidate; - public ComparerWithObjectsAndValueAttributesTests() + public ComparerWithObjectsAndValueAttributesTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); - kernel.RegisterSingleton, TestClassCompareRegistrations>(); + iocContainer.Initialize(); - this.testcandidate = kernel.GetInstance>(); + iocContainer.RegisterSingleton, TestClassCompareRegistrations>(); + + this.testcandidate = iocContainer.GetInstance>(); } #endregion diff --git a/src/BBT.StructureTools.Tests/Compare/ComparerWithValueAttributeTests.cs b/src/BBT.StructureTools.Tests/Compare/ComparerWithValueAttributeTests.cs index 36f3284..cc282ee 100644 --- a/src/BBT.StructureTools.Tests/Compare/ComparerWithValueAttributeTests.cs +++ b/src/BBT.StructureTools.Tests/Compare/ComparerWithValueAttributeTests.cs @@ -6,22 +6,23 @@ using BBT.StructureTools.Compare.Exclusions; using BBT.StructureTools.Compare.Helper; using BBT.StructureTools.Tests.Compare.Intention; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class ComparerWithValueAttributeTests { private readonly IComparer testcandidate; - public ComparerWithValueAttributeTests() + public ComparerWithValueAttributeTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton, TestClassCompareRegistrations>(); + iocContainer.RegisterSingleton, TestClassCompareRegistrations>(); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } [Test] diff --git a/src/BBT.StructureTools.Tests/Compare/SubComparerUsingComparerTests.cs b/src/BBT.StructureTools.Tests/Compare/SubComparerUsingComparerTests.cs index 61dc2a9..82eed6b 100644 --- a/src/BBT.StructureTools.Tests/Compare/SubComparerUsingComparerTests.cs +++ b/src/BBT.StructureTools.Tests/Compare/SubComparerUsingComparerTests.cs @@ -6,26 +6,27 @@ using BBT.StructureTools.Compare.Exclusions; using BBT.StructureTools.Compare.Helper; using BBT.StructureTools.Tests.Compare.Intention; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class SubComparerUsingComparerTests { #region Members, Setup private static IComparer parentCompare; private readonly IComparer testcandidate; - public SubComparerUsingComparerTests() + public SubComparerUsingComparerTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton, TestClassChildCompareRegistrations>(); - kernel.RegisterSingleton, TestClassParentCompareRegistrations>(); + iocContainer.RegisterSingleton, TestClassChildCompareRegistrations>(); + iocContainer.RegisterSingleton, TestClassParentCompareRegistrations>(); - parentCompare = kernel.GetInstance>(); - this.testcandidate = kernel.GetInstance>(); + parentCompare = iocContainer.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } #endregion diff --git a/src/BBT.StructureTools.Tests/Compare/ToManyComparerTests.cs b/src/BBT.StructureTools.Tests/Compare/ToManyComparerTests.cs index 47a6c00..20c921b 100644 --- a/src/BBT.StructureTools.Tests/Compare/ToManyComparerTests.cs +++ b/src/BBT.StructureTools.Tests/Compare/ToManyComparerTests.cs @@ -5,19 +5,20 @@ using BBT.StructureTools.Compare.Helper; using BBT.StructureTools.Initialization; using BBT.StructureTools.Tests.Compare.Intention; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class ToManyComparerTests { #region Members, Setup private readonly IComparer comparer; - public ToManyComparerTests() + public ToManyComparerTests(IIocContainer iocContainer) { - var iocContainer = new NinjectIocContainer(); + iocContainer.Initialize(); iocContainer.RegisterSingleton, TestClassCompareRegistrations>(); iocContainer.RegisterSingleton, TestClassListOfChildrenItemCompareRegistrations>(); diff --git a/src/BBT.StructureTools.Tests/Convert/ConvertHelperTests.cs b/src/BBT.StructureTools.Tests/Convert/ConvertHelperTests.cs index 13dbe7b..d2979e9 100644 --- a/src/BBT.StructureTools.Tests/Convert/ConvertHelperTests.cs +++ b/src/BBT.StructureTools.Tests/Convert/ConvertHelperTests.cs @@ -7,6 +7,7 @@ using Moq; using NUnit.Framework; + [TestFixture] public class ConvertHelperTests { [Test] diff --git a/src/BBT.StructureTools.Tests/Convert/ConvertRootTreeLeafWithMasterDataTests.cs b/src/BBT.StructureTools.Tests/Convert/ConvertRootTreeLeafWithMasterDataTests.cs index 20d728d..87b7925 100644 --- a/src/BBT.StructureTools.Tests/Convert/ConvertRootTreeLeafWithMasterDataTests.cs +++ b/src/BBT.StructureTools.Tests/Convert/ConvertRootTreeLeafWithMasterDataTests.cs @@ -11,32 +11,35 @@ using BBT.StructureTools.Tests.Convert.TestStructure.Source; using BBT.StructureTools.Tests.Convert.TestStructure.Target; using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [NonParallelizable] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class ConvertRootTreeLeafWithMasterDataTests { private readonly IConvert testcandidate; - public ConvertRootTreeLeafWithMasterDataTests() + public ConvertRootTreeLeafWithMasterDataTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton(typeof(ITemporalDataDescriptor<>), typeof(TemporalDataDescriptor)); + iocContainer.RegisterSingleton(typeof(ITemporalDataDescriptor), typeof(TemporalDataDescriptor)); - kernel.RegisterSingleton, RootTargetRootConvertRegistrations>(); + iocContainer.RegisterSingleton, RootTargetRootConvertRegistrations>(); - kernel.RegisterSingleton, TreeTargetTreeConvertRegistrations>(); - kernel.RegisterSingleton, TreeMasterDataToTreeConvertRegistrations>(); + iocContainer.RegisterSingleton, TreeTargetTreeConvertRegistrations>(); + iocContainer.RegisterSingleton, TreeMasterDataToTreeConvertRegistrations>(); - kernel.RegisterSingleton, LeafTargetLeafConvertRegistrations>(); - kernel.RegisterSingleton, LeafMasterDataTargetLeafConvertRegistrations>(); - kernel.RegisterSingleton, TemporalLeafMasterDataTemporalLeafDatconvertRegistrations>(); + iocContainer.RegisterSingleton, LeafTargetLeafConvertRegistrations>(); + iocContainer.RegisterSingleton, LeafMasterDataTargetLeafConvertRegistrations>(); + iocContainer.RegisterSingleton, TemporalLeafMasterDataTemporalLeafDatconvertRegistrations>(); - kernel.RegisterSingleton, TemporalDatcopyRegistrations>(); + iocContainer.RegisterSingleton, TemporalDatcopyRegistrations>(); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } [Test] diff --git a/src/BBT.StructureTools.Tests/Copy/CopierIntegrationTests.cs b/src/BBT.StructureTools.Tests/Copy/CopierIntegrationTests.cs index fb6bd55..6a447f3 100644 --- a/src/BBT.StructureTools.Tests/Copy/CopierIntegrationTests.cs +++ b/src/BBT.StructureTools.Tests/Copy/CopierIntegrationTests.cs @@ -6,25 +6,26 @@ using BBT.StructureTools.Copy; using BBT.StructureTools.Copy.Helper; using BBT.StructureTools.Copy.Processing; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class CopierIntegrationTests { #region members and setup private readonly ICopy testcandidate; - public CopierIntegrationTests() + public CopierIntegrationTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton, TestClassCopyRegistrations>(); - kernel.RegisterSingleton, ChildTestClassCopyRegistrations>(); - kernel.RegisterSingleton, ChildTestClass2CopyRegistrations>(); + iocContainer.RegisterSingleton, TestClassCopyRegistrations>(); + iocContainer.RegisterSingleton, ChildTestClassCopyRegistrations>(); + iocContainer.RegisterSingleton, ChildTestClass2CopyRegistrations>(); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } #endregion diff --git a/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToManyFromGenericStrategyIntTests.cs b/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToManyFromGenericStrategyIntTests.cs index a7559eb..97e4c81 100644 --- a/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToManyFromGenericStrategyIntTests.cs +++ b/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToManyFromGenericStrategyIntTests.cs @@ -7,27 +7,28 @@ using BBT.StructureTools.Copy; using BBT.StructureTools.Copy.Helper; using BBT.StructureTools.Copy.Strategy; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class CopyOperationCreateToManyFromGenericStrategyIntTests { #region setup private readonly ICopy testcandidate; - public CopyOperationCreateToManyFromGenericStrategyIntTests() + public CopyOperationCreateToManyFromGenericStrategyIntTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton, TestClassCopyRegistrations>(); - kernel.RegisterSingleton, ChildTestClassCopyRegistrations>(); - kernel.RegisterSingleton, TestFactory>(); - kernel.RegisterSingleton(); + iocContainer.RegisterSingleton, TestClassCopyRegistrations>(); + iocContainer.RegisterSingleton, ChildTestClassCopyRegistrations>(); + iocContainer.RegisterSingleton, TestFactory>(); + iocContainer.RegisterSingleton(); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } #endregion diff --git a/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToManyFromGenericStrategyWithReverseRelationIntTests.cs b/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToManyFromGenericStrategyWithReverseRelationIntTests.cs index 5012b7e..a954d41 100644 --- a/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToManyFromGenericStrategyWithReverseRelationIntTests.cs +++ b/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToManyFromGenericStrategyWithReverseRelationIntTests.cs @@ -7,27 +7,28 @@ using BBT.StructureTools.Copy; using BBT.StructureTools.Copy.Helper; using BBT.StructureTools.Copy.Strategy; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class CopyOperationCreateToManyFromGenericStrategyWithReverseRelationIntTests { #region setup private readonly ICopy testcandidate; - public CopyOperationCreateToManyFromGenericStrategyWithReverseRelationIntTests() + public CopyOperationCreateToManyFromGenericStrategyWithReverseRelationIntTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton, TestFactory>(); - kernel.RegisterSingleton(); - kernel.RegisterSingleton, TestClassCopyRegistrations>(); - kernel.RegisterSingleton, ChildTestClassCopyRegistrations>(); + iocContainer.RegisterSingleton, TestFactory>(); + iocContainer.RegisterSingleton(); + iocContainer.RegisterSingleton, TestClassCopyRegistrations>(); + iocContainer.RegisterSingleton, ChildTestClassCopyRegistrations>(); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } #endregion diff --git a/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToManyWithReverseRelationIntTests.cs b/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToManyWithReverseRelationIntTests.cs index a9ddc4a..a024601 100644 --- a/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToManyWithReverseRelationIntTests.cs +++ b/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToManyWithReverseRelationIntTests.cs @@ -6,24 +6,25 @@ using BBT.StructureTools; using BBT.StructureTools.Copy; using BBT.StructureTools.Copy.Helper; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class CopyOperationCreateToManyWithReverseRelationIntTests { #region members and setup private readonly ICopy testcandidate; - public CopyOperationCreateToManyWithReverseRelationIntTests() + public CopyOperationCreateToManyWithReverseRelationIntTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton, TestClassCopyRegistrations>(); - kernel.RegisterSingleton, ChildTestClassCopyRegistrations>(); + iocContainer.RegisterSingleton, TestClassCopyRegistrations>(); + iocContainer.RegisterSingleton, ChildTestClassCopyRegistrations>(); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } #endregion diff --git a/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToOneWithReverseRelationIntTests.cs b/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToOneWithReverseRelationIntTests.cs index 17e4375..c50672b 100644 --- a/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToOneWithReverseRelationIntTests.cs +++ b/src/BBT.StructureTools.Tests/Copy/CopyOperationCreateToOneWithReverseRelationIntTests.cs @@ -5,24 +5,25 @@ using BBT.StructureTools; using BBT.StructureTools.Copy; using BBT.StructureTools.Copy.Helper; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class CopyOperationCreateToOneWithReverseRelationIntTests { #region members and setup private readonly ICopy testcandidate; - public CopyOperationCreateToOneWithReverseRelationIntTests() + public CopyOperationCreateToOneWithReverseRelationIntTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton, TestClassCopyRegistrations>(); - kernel.RegisterSingleton, ChildTestClassCopyRegistrations>(); + iocContainer.RegisterSingleton, TestClassCopyRegistrations>(); + iocContainer.RegisterSingleton, ChildTestClassCopyRegistrations>(); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } #endregion diff --git a/src/BBT.StructureTools.Tests/Copy/CopyOperationCrossReferenceProcessingIntTests.cs b/src/BBT.StructureTools.Tests/Copy/CopyOperationCrossReferenceProcessingIntTests.cs index cc741b5..6dd8850 100644 --- a/src/BBT.StructureTools.Tests/Copy/CopyOperationCrossReferenceProcessingIntTests.cs +++ b/src/BBT.StructureTools.Tests/Copy/CopyOperationCrossReferenceProcessingIntTests.cs @@ -4,24 +4,25 @@ using BBT.StructureTools; using BBT.StructureTools.Copy; using BBT.StructureTools.Copy.Helper; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class CopyOperationCrossReferenceProcessingIntTests { private readonly ICopy testcandidate; - public CopyOperationCrossReferenceProcessingIntTests() + public CopyOperationCrossReferenceProcessingIntTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton, TestClassCopyRegistrations>(); - kernel.RegisterSingleton, TestClassChildCopyRegistrations>(); - kernel.RegisterSingleton, TestClassCrossReferencedChildCopyRegistrations>(); + iocContainer.RegisterSingleton, TestClassCopyRegistrations>(); + iocContainer.RegisterSingleton, TestClassChildCopyRegistrations>(); + iocContainer.RegisterSingleton, TestClassCrossReferencedChildCopyRegistrations>(); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } /// diff --git a/src/BBT.StructureTools.Tests/Copy/CopyOperationInlineValueProcessingTests.cs b/src/BBT.StructureTools.Tests/Copy/CopyOperationInlineValueProcessingTests.cs index 75018c6..f2b42e6 100644 --- a/src/BBT.StructureTools.Tests/Copy/CopyOperationInlineValueProcessingTests.cs +++ b/src/BBT.StructureTools.Tests/Copy/CopyOperationInlineValueProcessingTests.cs @@ -5,22 +5,23 @@ using BBT.StructureTools; using BBT.StructureTools.Copy; using BBT.StructureTools.Copy.Helper; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class CopyOperationInlineValueProcessingTests { private readonly ICopy testcandidate; - public CopyOperationInlineValueProcessingTests() + public CopyOperationInlineValueProcessingTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton, TestClassCopyRegistrations>(); + iocContainer.RegisterSingleton, TestClassCopyRegistrations>(); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } /// diff --git a/src/BBT.StructureTools.Tests/Copy/CopyOperationIntTests.cs b/src/BBT.StructureTools.Tests/Copy/CopyOperationIntTests.cs index 6ac8bb7..5f0a20a 100644 --- a/src/BBT.StructureTools.Tests/Copy/CopyOperationIntTests.cs +++ b/src/BBT.StructureTools.Tests/Copy/CopyOperationIntTests.cs @@ -5,22 +5,23 @@ using BBT.StructureTools.Copy; using BBT.StructureTools.Copy.Helper; using BBT.StructureTools.Copy.Processing; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class CopyOperationIntTests { private readonly ICopy testcandidate; - public CopyOperationIntTests() + public CopyOperationIntTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton, TestClassCopyRegistrations>(); + iocContainer.RegisterSingleton, TestClassCopyRegistrations>(); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } /// diff --git a/src/BBT.StructureTools.Tests/Copy/CopyOperationRegisterCreateFromFactoryTests.cs b/src/BBT.StructureTools.Tests/Copy/CopyOperationRegisterCreateFromFactoryTests.cs index 65e29ca..58a5eb9 100644 --- a/src/BBT.StructureTools.Tests/Copy/CopyOperationRegisterCreateFromFactoryTests.cs +++ b/src/BBT.StructureTools.Tests/Copy/CopyOperationRegisterCreateFromFactoryTests.cs @@ -4,23 +4,24 @@ using BBT.StructureTools; using BBT.StructureTools.Copy; using BBT.StructureTools.Copy.Helper; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class CopyOperationRegisterCreateFromFactoryTests { private readonly ICopy testcandidate; - public CopyOperationRegisterCreateFromFactoryTests() + public CopyOperationRegisterCreateFromFactoryTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton(typeof(ICopyRegistrations), typeof(TestClassCopyRegistrations)); - kernel.RegisterSingleton(typeof(ITestFactory), typeof(TestFactory)); + iocContainer.RegisterSingleton(typeof(ICopyRegistrations), typeof(TestClassCopyRegistrations)); + iocContainer.RegisterSingleton(typeof(ITestFactory), typeof(TestFactory)); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } /// diff --git a/src/BBT.StructureTools.Tests/Copy/CopyOperationSubCopyIntTests.cs b/src/BBT.StructureTools.Tests/Copy/CopyOperationSubCopyIntTests.cs index fb9444c..9848c18 100644 --- a/src/BBT.StructureTools.Tests/Copy/CopyOperationSubCopyIntTests.cs +++ b/src/BBT.StructureTools.Tests/Copy/CopyOperationSubCopyIntTests.cs @@ -5,23 +5,24 @@ using BBT.StructureTools.Copy; using BBT.StructureTools.Copy.Helper; using BBT.StructureTools.Copy.Processing; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class CopyOperationSubCopyIntTests { private readonly ICopy testcandidate; - public CopyOperationSubCopyIntTests() + public CopyOperationSubCopyIntTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton, TestClassChildCopyRegistrations>(); - kernel.RegisterSingleton, TestClassParentCopyRegistrations>(); + iocContainer.RegisterSingleton, TestClassChildCopyRegistrations>(); + iocContainer.RegisterSingleton, TestClassParentCopyRegistrations>(); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } /// diff --git a/src/BBT.StructureTools.Tests/Copy/PostProcessing/CopyOperationPostProcessingUsingParamsIntTests.cs b/src/BBT.StructureTools.Tests/Copy/PostProcessing/CopyOperationPostProcessingUsingParamsIntTests.cs index 63a3d3d..204a3c6 100644 --- a/src/BBT.StructureTools.Tests/Copy/PostProcessing/CopyOperationPostProcessingUsingParamsIntTests.cs +++ b/src/BBT.StructureTools.Tests/Copy/PostProcessing/CopyOperationPostProcessingUsingParamsIntTests.cs @@ -4,24 +4,25 @@ using BBT.StructureTools.Copy; using BBT.StructureTools.Copy.Helper; using BBT.StructureTools.Copy.Processing; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public sealed class CopyOperationPostProcessingUsingParamsIntTests { #region setup and members private readonly ICopy testcandidate; - public CopyOperationPostProcessingUsingParamsIntTests() + public CopyOperationPostProcessingUsingParamsIntTests(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton(typeof(ICopyRegistrations), typeof(TestClassCopyRegistrations)); + iocContainer.RegisterSingleton(typeof(ICopyRegistrations), typeof(TestClassCopyRegistrations)); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } #endregion diff --git a/src/BBT.StructureTools.Tests/Copy/PostProcessing/CopyOperationPostProcessingWithoutUsingParamsIntTest.cs b/src/BBT.StructureTools.Tests/Copy/PostProcessing/CopyOperationPostProcessingWithoutUsingParamsIntTest.cs index ca2181a..8714864 100644 --- a/src/BBT.StructureTools.Tests/Copy/PostProcessing/CopyOperationPostProcessingWithoutUsingParamsIntTest.cs +++ b/src/BBT.StructureTools.Tests/Copy/PostProcessing/CopyOperationPostProcessingWithoutUsingParamsIntTest.cs @@ -4,24 +4,25 @@ using BBT.StructureTools.Copy; using BBT.StructureTools.Copy.Helper; using BBT.StructureTools.Copy.Processing; - using BBT.StructureTools.Tests.TestTools; + using BBT.StructureTools.Tests.TestTools.IoC; using FluentAssertions; using NUnit.Framework; [TestFixture] + [TestFixtureSource(typeof(IocTestFixtureSource), "IocContainers")] public class CopyOperationPostProcessingWithoutUsingParamsIntTest { #region setup and members private readonly ICopy testcandidate; - public CopyOperationPostProcessingWithoutUsingParamsIntTest() + public CopyOperationPostProcessingWithoutUsingParamsIntTest(IIocContainer iocContainer) { - var kernel = new NinjectIocContainer(); + iocContainer.Initialize(); - kernel.RegisterSingleton(typeof(ICopyRegistrations), typeof(TestClassCopyRegistrations)); + iocContainer.RegisterSingleton(typeof(ICopyRegistrations), typeof(TestClassCopyRegistrations)); - this.testcandidate = kernel.GetInstance>(); + this.testcandidate = iocContainer.GetInstance>(); } #endregion diff --git a/src/BBT.StructureTools.Tests/TestTools/IoC/IIocContainer.cs b/src/BBT.StructureTools.Tests/TestTools/IoC/IIocContainer.cs index bbcdb6e..b60a49f 100644 --- a/src/BBT.StructureTools.Tests/TestTools/IoC/IIocContainer.cs +++ b/src/BBT.StructureTools.Tests/TestTools/IoC/IIocContainer.cs @@ -5,7 +5,7 @@ /// /// Abstraction of any IoC container to be used for testing. /// - internal interface IIocContainer + public interface IIocContainer { /// /// Initializes the IoC container. @@ -19,6 +19,7 @@ internal interface IIocContainer /// Abstraction (interface) type. /// Implementation of . void RegisterSingleton() + where TAbstraction : class where TImplementation : TAbstraction; /// @@ -28,6 +29,7 @@ void RegisterSingleton() /// Abstraction (interface) type. /// Implementation of . void RegisterTransient() + where TAbstraction : class where TImplementation : TAbstraction; /// diff --git a/src/BBT.StructureTools.Tests/TestTools/IoC/NinjectStrategyLocator.cs b/src/BBT.StructureTools.Tests/TestTools/IoC/IocHandlerStrategyLocator.cs similarity index 80% rename from src/BBT.StructureTools.Tests/TestTools/IoC/NinjectStrategyLocator.cs rename to src/BBT.StructureTools.Tests/TestTools/IoC/IocHandlerStrategyLocator.cs index 4b6f5d8..8395d71 100644 --- a/src/BBT.StructureTools.Tests/TestTools/IoC/NinjectStrategyLocator.cs +++ b/src/BBT.StructureTools.Tests/TestTools/IoC/IocHandlerStrategyLocator.cs @@ -4,7 +4,7 @@ using BBT.StrategyPattern; using BBT.StructureTools.Initialization; - public class NinjectStrategyLocator : IStrategyLocator + public class IocHandlerStrategyLocator : IStrategyLocator { public IEnumerable GetAllStrategies() { diff --git a/src/BBT.StructureTools.Tests/TestTools/IoC/IocTestFixtureSource.cs b/src/BBT.StructureTools.Tests/TestTools/IoC/IocTestFixtureSource.cs new file mode 100644 index 0000000..7e22e0e --- /dev/null +++ b/src/BBT.StructureTools.Tests/TestTools/IoC/IocTestFixtureSource.cs @@ -0,0 +1,24 @@ +namespace BBT.StructureTools.Tests.TestTools.IoC +{ + using BBT.StructureTools.Tests.TestTools.IoC.Vendor; + + /// + /// Class is internally used to provide + /// different IoC containers to test fixtures where + /// needed. See also https://github.com/nunit/docs/wiki/TestFixtureSource-Attribute. + /// + internal class IocTestFixtureSource + { +#pragma warning disable SA1401 // Fields should be private + /// + /// Returns implementations + /// for the tested IoC containers. + /// + internal static object[] IocContainers = +#pragma warning restore SA1401 // Fields should be private + { + new NinjectIocContainer(), + new CastleIocContainer(), + }; + } +} diff --git a/src/BBT.StructureTools.Tests/TestTools/IoC/Vendor/CastleIocContainer.cs b/src/BBT.StructureTools.Tests/TestTools/IoC/Vendor/CastleIocContainer.cs new file mode 100644 index 0000000..85ee56c --- /dev/null +++ b/src/BBT.StructureTools.Tests/TestTools/IoC/Vendor/CastleIocContainer.cs @@ -0,0 +1,58 @@ +namespace BBT.StructureTools.Tests.TestTools.IoC.Vendor +{ + using System; + using BBT.StrategyPattern; + using BBT.StructureTools.Initialization; + using Castle.MicroKernel.Registration; + using Castle.Windsor; + + /// + internal class CastleIocContainer : IIocContainer + { + private IWindsorContainer castleContainer; + + /// + public T GetInstance() + { + return this.castleContainer.Resolve(); + } + + /// + public void Initialize() + { + this.castleContainer = new WindsorContainer(); + + var resolver = new CastleResolver(this.castleContainer); + + IocHandler.Instance.IocResolver = resolver; + + // Dependencies from BBT.StrategyPattern + this.castleContainer.Register(Component.For(typeof(IStrategyLocator<>)).ImplementedBy(typeof(IocHandlerStrategyLocator<>))); + this.castleContainer.Register(Component.For(typeof(IInstanceCreator<,>)).ImplementedBy(typeof(GenericInstanceCreator<,>))); + + IocHandler.Instance.DoIocRegistrations(this.RegisterSingleton); + } + + /// + public void RegisterSingleton() + where TAbstraction : class + where TImplementation : TAbstraction + { + this.castleContainer.Register(Component.For().ImplementedBy()); + } + + /// + public void RegisterTransient() + where TAbstraction : class + where TImplementation : TAbstraction + { + this.castleContainer.Register(Component.For().ImplementedBy().LifestyleTransient()); + } + + /// + public void RegisterSingleton(Type abstraction, Type implementation) + { + this.castleContainer.Register(Component.For(abstraction).ImplementedBy(implementation)); + } + } +} diff --git a/src/BBT.StructureTools.Tests/TestTools/IoC/Vendor/CastleResolver.cs b/src/BBT.StructureTools.Tests/TestTools/IoC/Vendor/CastleResolver.cs new file mode 100644 index 0000000..0aae36c --- /dev/null +++ b/src/BBT.StructureTools.Tests/TestTools/IoC/Vendor/CastleResolver.cs @@ -0,0 +1,41 @@ +namespace BBT.StructureTools.Tests.TestTools.IoC.Vendor +{ + using System; + using System.Collections.Generic; + using BBT.StructureTools.Initialization; + using Castle.Windsor; + + /// + /// implementation for Castle Windsor. + /// + internal class CastleResolver : IIocResolver + { + private readonly IWindsorContainer windsorContainer; + + /// + /// Initializes a new instance of the class. + /// + public CastleResolver(IWindsorContainer windsorContainer) + { + this.windsorContainer = windsorContainer; + } + + /// + public IEnumerable GetAllInstances() + { + return this.windsorContainer.ResolveAll(); + } + + /// + public TService GetInstance() + { + return this.windsorContainer.Resolve(); + } + + /// + public object GetInstance(Type serviceType) + { + return this.windsorContainer.Resolve(serviceType); + } + } +} diff --git a/src/BBT.StructureTools.Tests/TestTools/IoC/NinjectIocContainer.cs b/src/BBT.StructureTools.Tests/TestTools/IoC/Vendor/NinjectIocContainer.cs similarity index 85% rename from src/BBT.StructureTools.Tests/TestTools/IoC/NinjectIocContainer.cs rename to src/BBT.StructureTools.Tests/TestTools/IoC/Vendor/NinjectIocContainer.cs index 5deb802..5fb7495 100644 --- a/src/BBT.StructureTools.Tests/TestTools/IoC/NinjectIocContainer.cs +++ b/src/BBT.StructureTools.Tests/TestTools/IoC/Vendor/NinjectIocContainer.cs @@ -1,4 +1,4 @@ -namespace BBT.StructureTools.Tests.TestTools +namespace BBT.StructureTools.Tests.TestTools.IoC.Vendor { using System; using BBT.StrategyPattern; @@ -11,14 +11,6 @@ internal class NinjectIocContainer : IIocContainer { private StandardKernel ninjectKernel; - /// - /// Initializes a new instance of the class. - /// - public NinjectIocContainer() - { - this.Initialize(); - } - /// public T GetInstance() { @@ -39,7 +31,7 @@ public void Initialize() IocHandler.Instance.IocResolver = resolver; // Dependencies from BBT.StrategyPattern - this.ninjectKernel.Bind(typeof(IStrategyLocator<>)).To(typeof(NinjectStrategyLocator<>)); + this.ninjectKernel.Bind(typeof(IStrategyLocator<>)).To(typeof(IocHandlerStrategyLocator<>)); this.ninjectKernel.Bind(typeof(IInstanceCreator<,>)).To(typeof(GenericInstanceCreator<,>)); IocHandler.Instance.DoIocRegistrations(this.RegisterSingleton); @@ -47,6 +39,7 @@ public void Initialize() /// public void RegisterSingleton() + where TAbstraction : class where TImplementation : TAbstraction { this.ninjectKernel.Bind().To().InSingletonScope(); @@ -54,6 +47,7 @@ public void RegisterSingleton() /// public void RegisterTransient() + where TAbstraction : class where TImplementation : TAbstraction { this.ninjectKernel.Bind().To().InTransientScope(); diff --git a/src/BBT.StructureTools.Tests/TestTools/IoC/NinjectResolver.cs b/src/BBT.StructureTools.Tests/TestTools/IoC/Vendor/NinjectResolver.cs similarity index 93% rename from src/BBT.StructureTools.Tests/TestTools/IoC/NinjectResolver.cs rename to src/BBT.StructureTools.Tests/TestTools/IoC/Vendor/NinjectResolver.cs index 3ac06c8..a8d5507 100644 --- a/src/BBT.StructureTools.Tests/TestTools/IoC/NinjectResolver.cs +++ b/src/BBT.StructureTools.Tests/TestTools/IoC/Vendor/NinjectResolver.cs @@ -1,4 +1,4 @@ -namespace BBT.StructureTools.Tests.TestTools.IoC +namespace BBT.StructureTools.Tests.TestTools.IoC.Vendor { using System; using System.Collections.Generic; diff --git a/src/BBT.StructureTools/Compare/CompareHelper.cs b/src/BBT.StructureTools/Compare/CompareHelper.cs index b2dcb4f..51e780a 100644 --- a/src/BBT.StructureTools/Compare/CompareHelper.cs +++ b/src/BBT.StructureTools/Compare/CompareHelper.cs @@ -10,7 +10,7 @@ internal class CompareHelper : ICompareHelper /// /// Initializes a new instance of the class. /// - internal CompareHelper() + public CompareHelper() { } diff --git a/src/BBT.StructureTools/Compare/Comparer.cs b/src/BBT.StructureTools/Compare/Comparer.cs index 5add3f5..0f85227 100644 --- a/src/BBT.StructureTools/Compare/Comparer.cs +++ b/src/BBT.StructureTools/Compare/Comparer.cs @@ -16,7 +16,7 @@ internal class Comparer : IComparer /// /// Initializes a new instance of the class. /// - internal Comparer( + public Comparer( ICompareRegistrations compareRegistrations, IEqualityComparerHelperRegistrationFactory factory, ICompareHelper compareHelper) diff --git a/src/BBT.StructureTools/Convert/Converter.cs b/src/BBT.StructureTools/Convert/Converter.cs index 518f813..9b1d21f 100644 --- a/src/BBT.StructureTools/Convert/Converter.cs +++ b/src/BBT.StructureTools/Convert/Converter.cs @@ -15,7 +15,7 @@ public class Converter : IConvert /// Initializes a new instance of the class. /// - internal Converter( + public Converter( IConvertRegistrations convertRegistrations, IConvertEngine convertEngine, IConvertHelper convertHelper) diff --git a/src/BBT.StructureTools/Convert/IConvertEngine.cs b/src/BBT.StructureTools/Convert/IConvertEngine.cs index a310ea7..47c1bd6 100644 --- a/src/BBT.StructureTools/Convert/IConvertEngine.cs +++ b/src/BBT.StructureTools/Convert/IConvertEngine.cs @@ -5,7 +5,7 @@ /// /// The source to copy from. /// The target to copy to. - internal interface IConvertEngine + public interface IConvertEngine where TSource : class where TTarget : class { diff --git a/src/BBT.StructureTools/Convert/IConvertHelper.cs b/src/BBT.StructureTools/Convert/IConvertHelper.cs index a320651..5b712f6 100644 --- a/src/BBT.StructureTools/Convert/IConvertHelper.cs +++ b/src/BBT.StructureTools/Convert/IConvertHelper.cs @@ -5,7 +5,7 @@ /// /// Helper for the convert implementations. /// - internal interface IConvertHelper + public interface IConvertHelper { /// /// Start the convert pre process it it's needed. diff --git a/src/BBT.StructureTools/Convert/Strategy/OperationCopyValueWithLookup.cs b/src/BBT.StructureTools/Convert/Strategy/OperationCopyValueWithLookup.cs index 76ceff6..7e4e31b 100644 --- a/src/BBT.StructureTools/Convert/Strategy/OperationCopyValueWithLookup.cs +++ b/src/BBT.StructureTools/Convert/Strategy/OperationCopyValueWithLookup.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Linq.Expressions; - using BBT.StructureTools.Convert.Strategy; using BBT.StructureTools.Extension; /// diff --git a/src/BBT.StructureTools/Copy/Helper/CopyHelperFactory.cs b/src/BBT.StructureTools/Copy/Helper/CopyHelperFactory.cs index c90985e..ddd731c 100644 --- a/src/BBT.StructureTools/Copy/Helper/CopyHelperFactory.cs +++ b/src/BBT.StructureTools/Copy/Helper/CopyHelperFactory.cs @@ -2,7 +2,6 @@ { using System; using System.Linq.Expressions; - using BBT.StructureTools.Convert; using BBT.StructureTools.Copy; using BBT.StructureTools.Extension; using BBT.StructureTools.Initialization; diff --git a/src/BBT.StructureTools/Copy/Helper/CreateCopyHelper.cs b/src/BBT.StructureTools/Copy/Helper/CreateCopyHelper.cs index 4b6526e..9bac3fc 100644 --- a/src/BBT.StructureTools/Copy/Helper/CreateCopyHelper.cs +++ b/src/BBT.StructureTools/Copy/Helper/CreateCopyHelper.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Linq.Expressions; using BBT.StrategyPattern; - using BBT.StructureTools.Convert; using BBT.StructureTools.Copy; using BBT.StructureTools.Copy.Processing; using BBT.StructureTools.Extension; diff --git a/src/BBT.StructureTools/Copy/Helper/ICopyHelperRegistration.cs b/src/BBT.StructureTools/Copy/Helper/ICopyHelperRegistration.cs index 502a535..0997137 100644 --- a/src/BBT.StructureTools/Copy/Helper/ICopyHelperRegistration.cs +++ b/src/BBT.StructureTools/Copy/Helper/ICopyHelperRegistration.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Linq.Expressions; - using BBT.StructureTools.Copy.Operation; using BBT.StructureTools.Copy.Strategy; /// diff --git a/src/BBT.StructureTools/Copy/Operation/CopyOperationCreateToManyWithReverseRelation.cs b/src/BBT.StructureTools/Copy/Operation/CopyOperationCreateToManyWithReverseRelation.cs index ce4b597..791e49f 100644 --- a/src/BBT.StructureTools/Copy/Operation/CopyOperationCreateToManyWithReverseRelation.cs +++ b/src/BBT.StructureTools/Copy/Operation/CopyOperationCreateToManyWithReverseRelation.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Linq.Expressions; using BBT.MaybePattern; - using BBT.StructureTools.Convert.Strategy; using BBT.StructureTools.Copy; using BBT.StructureTools.Extension; diff --git a/src/BBT.StructureTools/Extension/BitOperations.cs b/src/BBT.StructureTools/Extension/BitOperations.cs index ebdeed9..de78855 100644 --- a/src/BBT.StructureTools/Extension/BitOperations.cs +++ b/src/BBT.StructureTools/Extension/BitOperations.cs @@ -1,7 +1,5 @@ namespace BBT.StructureTools.Extension { - using System; - /// /// Helps with bit operations. ///