From 91ba1f234f7d4c83578d0e0562bb17b8e749aa69 Mon Sep 17 00:00:00 2001 From: Eugene Sadovoi Date: Fri, 6 Oct 2017 17:41:22 -0400 Subject: [PATCH] Fixed tests --- tests/ConfigFiles/ArrayInjection.config | 5 +- tests/ConfigFiles/BasicTypeMapping.config | 4 +- tests/ConfigFiles/ContainerExtensions.config | 4 +- tests/ConfigFiles/EmptySection.config | 2 +- tests/ConfigFiles/Generics.config | 4 +- tests/ConfigFiles/InjectingGenerics.config | 4 +- tests/ConfigFiles/InjectingProperties.config | 10 ++-- tests/ConfigFiles/Lifetimes.config | 12 ++--- tests/ConfigFiles/MethodInjection.config | 10 ++-- tests/ConfigFiles/OldAliasesSyntax.config | 14 ++--- tests/ConfigFiles/OldContainersSyntax.config | 2 +- tests/ConfigFiles/OldTypeMappingSyntax.config | 2 +- tests/ConfigFiles/OptionalDependency.config | 4 +- tests/ConfigFiles/RegisteringInstances.config | 4 +- .../RegistrationWithConstructors.config | 2 +- tests/ConfigFiles/SectionExtensions.config | 6 +-- ...ingleSectionMultipleNamedContainers.config | 2 +- .../SingleSectionSingleContainer.config | 2 +- .../TwoContainersAndAliases.config | 2 +- tests/ConfigFiles/VariousConstructors.config | 8 +-- tests/Configuration.Tests.csproj | 52 +++++++++++++++++++ .../Configuration/ConfigFileLoader.cs | 6 ++- tests/TestSupport/RegistrationsToAssertOn.cs | 4 +- tests/When_ResolvingTypes.cs | 6 +-- ..._ResolvingTypesWithoutNamespacesDefined.cs | 6 +-- 25 files changed, 115 insertions(+), 62 deletions(-) diff --git a/tests/ConfigFiles/ArrayInjection.config b/tests/ConfigFiles/ArrayInjection.config index 37daaee..e704341 100644 --- a/tests/ConfigFiles/ArrayInjection.config +++ b/tests/ConfigFiles/ArrayInjection.config @@ -1,14 +1,13 @@  -
+
- - + diff --git a/tests/ConfigFiles/BasicTypeMapping.config b/tests/ConfigFiles/BasicTypeMapping.config index a2bff63..b60e726 100644 --- a/tests/ConfigFiles/BasicTypeMapping.config +++ b/tests/ConfigFiles/BasicTypeMapping.config @@ -1,12 +1,12 @@  -
+
- + diff --git a/tests/ConfigFiles/ContainerExtensions.config b/tests/ConfigFiles/ContainerExtensions.config index 6be084f..b6c9e67 100644 --- a/tests/ConfigFiles/ContainerExtensions.config +++ b/tests/ConfigFiles/ContainerExtensions.config @@ -1,12 +1,12 @@  -
+
- + diff --git a/tests/ConfigFiles/EmptySection.config b/tests/ConfigFiles/EmptySection.config index cf9fa86..9a50e0f 100644 --- a/tests/ConfigFiles/EmptySection.config +++ b/tests/ConfigFiles/EmptySection.config @@ -1,7 +1,7 @@  -
+
diff --git a/tests/ConfigFiles/Generics.config b/tests/ConfigFiles/Generics.config index 9b887ce..07e09fc 100644 --- a/tests/ConfigFiles/Generics.config +++ b/tests/ConfigFiles/Generics.config @@ -3,14 +3,14 @@
+ Unity.Configuration" /> - + diff --git a/tests/ConfigFiles/InjectingGenerics.config b/tests/ConfigFiles/InjectingGenerics.config index c51dff7..1413f7c 100644 --- a/tests/ConfigFiles/InjectingGenerics.config +++ b/tests/ConfigFiles/InjectingGenerics.config @@ -1,12 +1,12 @@  -
+
- + diff --git a/tests/ConfigFiles/InjectingProperties.config b/tests/ConfigFiles/InjectingProperties.config index 9761ae3..25fe193 100644 --- a/tests/ConfigFiles/InjectingProperties.config +++ b/tests/ConfigFiles/InjectingProperties.config @@ -1,15 +1,15 @@  -
+
- - - - + + + + diff --git a/tests/ConfigFiles/Lifetimes.config b/tests/ConfigFiles/Lifetimes.config index 8db83dc..3bb830b 100644 --- a/tests/ConfigFiles/Lifetimes.config +++ b/tests/ConfigFiles/Lifetimes.config @@ -1,16 +1,16 @@  -
+
- - - - - + + + + + diff --git a/tests/ConfigFiles/MethodInjection.config b/tests/ConfigFiles/MethodInjection.config index fd59365..5bc3f12 100644 --- a/tests/ConfigFiles/MethodInjection.config +++ b/tests/ConfigFiles/MethodInjection.config @@ -1,7 +1,7 @@  -
+
@@ -9,10 +9,10 @@ - - - - + + + + diff --git a/tests/ConfigFiles/OldAliasesSyntax.config b/tests/ConfigFiles/OldAliasesSyntax.config index 08b56b7..9accce8 100644 --- a/tests/ConfigFiles/OldAliasesSyntax.config +++ b/tests/ConfigFiles/OldAliasesSyntax.config @@ -1,19 +1,19 @@  -
+
- - - - - - + + + + + + diff --git a/tests/ConfigFiles/OldContainersSyntax.config b/tests/ConfigFiles/OldContainersSyntax.config index 7c4b30b..2c58c4e 100644 --- a/tests/ConfigFiles/OldContainersSyntax.config +++ b/tests/ConfigFiles/OldContainersSyntax.config @@ -1,7 +1,7 @@  -
+
diff --git a/tests/ConfigFiles/OldTypeMappingSyntax.config b/tests/ConfigFiles/OldTypeMappingSyntax.config index 1c92de1..49eb34c 100644 --- a/tests/ConfigFiles/OldTypeMappingSyntax.config +++ b/tests/ConfigFiles/OldTypeMappingSyntax.config @@ -1,7 +1,7 @@  -
+
diff --git a/tests/ConfigFiles/OptionalDependency.config b/tests/ConfigFiles/OptionalDependency.config index ad48de0..0363fec 100644 --- a/tests/ConfigFiles/OptionalDependency.config +++ b/tests/ConfigFiles/OptionalDependency.config @@ -1,12 +1,12 @@  -
+
- + diff --git a/tests/ConfigFiles/RegisteringInstances.config b/tests/ConfigFiles/RegisteringInstances.config index de4b202..e3e9564 100644 --- a/tests/ConfigFiles/RegisteringInstances.config +++ b/tests/ConfigFiles/RegisteringInstances.config @@ -1,11 +1,11 @@  -
+
- + diff --git a/tests/ConfigFiles/RegistrationWithConstructors.config b/tests/ConfigFiles/RegistrationWithConstructors.config index fba79cb..da28f38 100644 --- a/tests/ConfigFiles/RegistrationWithConstructors.config +++ b/tests/ConfigFiles/RegistrationWithConstructors.config @@ -1,7 +1,7 @@  -
+
diff --git a/tests/ConfigFiles/SectionExtensions.config b/tests/ConfigFiles/SectionExtensions.config index e61784c..94b300a 100644 --- a/tests/ConfigFiles/SectionExtensions.config +++ b/tests/ConfigFiles/SectionExtensions.config @@ -1,12 +1,12 @@  -
+
- - + + diff --git a/tests/ConfigFiles/SingleSectionMultipleNamedContainers.config b/tests/ConfigFiles/SingleSectionMultipleNamedContainers.config index 969ba86..d836ca0 100644 --- a/tests/ConfigFiles/SingleSectionMultipleNamedContainers.config +++ b/tests/ConfigFiles/SingleSectionMultipleNamedContainers.config @@ -1,7 +1,7 @@  -
+
diff --git a/tests/ConfigFiles/SingleSectionSingleContainer.config b/tests/ConfigFiles/SingleSectionSingleContainer.config index b5aa465..fbdb442 100644 --- a/tests/ConfigFiles/SingleSectionSingleContainer.config +++ b/tests/ConfigFiles/SingleSectionSingleContainer.config @@ -1,7 +1,7 @@  -
+
diff --git a/tests/ConfigFiles/TwoContainersAndAliases.config b/tests/ConfigFiles/TwoContainersAndAliases.config index 6a70644..3c51f46 100644 --- a/tests/ConfigFiles/TwoContainersAndAliases.config +++ b/tests/ConfigFiles/TwoContainersAndAliases.config @@ -1,7 +1,7 @@  -
+
diff --git a/tests/ConfigFiles/VariousConstructors.config b/tests/ConfigFiles/VariousConstructors.config index ae39286..e79cbd5 100644 --- a/tests/ConfigFiles/VariousConstructors.config +++ b/tests/ConfigFiles/VariousConstructors.config @@ -1,14 +1,14 @@  -
+
- - - + + + diff --git a/tests/Configuration.Tests.csproj b/tests/Configuration.Tests.csproj index f482f3f..8f0b808 100644 --- a/tests/Configuration.Tests.csproj +++ b/tests/Configuration.Tests.csproj @@ -6,6 +6,54 @@ Microsoft.Practices.Unity.Configuration.Tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -21,4 +69,8 @@ + + + + diff --git a/tests/TestSupport/Configuration/ConfigFileLoader.cs b/tests/TestSupport/Configuration/ConfigFileLoader.cs index ccfef35..cd1cf73 100644 --- a/tests/TestSupport/Configuration/ConfigFileLoader.cs +++ b/tests/TestSupport/Configuration/ConfigFileLoader.cs @@ -4,6 +4,7 @@ using System; using System.Configuration; using System.IO; using Microsoft.Practices.ObjectBuilder2; +using System.Linq; namespace Microsoft.Practices.Unity.TestSupport.Configuration { @@ -49,9 +50,10 @@ namespace Microsoft.Practices.Unity.TestSupport.Configuration private static Stream GetResourceStream(string configFileName) { - string resourceName = Sequence.Collect(GetResourceNamespace(), configFileName, "config").JoinStrings("."); - + var name = configFileName + ".config"; var currentAssembly = typeof(TResourceLocator).Assembly; + string resourceName = currentAssembly.GetManifestResourceNames().First(it => it.EndsWith(name)); + return currentAssembly.GetManifestResourceStream(resourceName); } diff --git a/tests/TestSupport/RegistrationsToAssertOn.cs b/tests/TestSupport/RegistrationsToAssertOn.cs index 099ba2f..bfdb621 100644 --- a/tests/TestSupport/RegistrationsToAssertOn.cs +++ b/tests/TestSupport/RegistrationsToAssertOn.cs @@ -8,9 +8,9 @@ namespace Microsoft.Practices.Unity.TestSupport { public class RegistrationsToAssertOn { - public readonly IEnumerable Registrations; + public readonly IEnumerable Registrations; - public RegistrationsToAssertOn(IEnumerable registrations) + public RegistrationsToAssertOn(IEnumerable registrations) { this.Registrations = registrations; } diff --git a/tests/When_ResolvingTypes.cs b/tests/When_ResolvingTypes.cs index ed3091c..6085bb9 100644 --- a/tests/When_ResolvingTypes.cs +++ b/tests/When_ResolvingTypes.cs @@ -22,11 +22,11 @@ namespace Microsoft.Practices.Unity.Configuration.Tests var aliases = new Dictionary { { "dict", typeof(Dictionary<,>).AssemblyQualifiedName }, - { "ILogger", "Microsoft.Practices.Unity.TestSupport.ILogger, Unity.TestSupport" }, - { "MockLogger", "Microsoft.Practices.Unity.TestSupport.MockLogger, Unity.TestSupport" } + { "ILogger", "Microsoft.Practices.Unity.TestSupport.ILogger, Configuration.Tests" }, + { "MockLogger", "Microsoft.Practices.Unity.TestSupport.MockLogger, Configuration.Tests" } }; - var namespaces = new[] { "System", "System.Collections.Generic", "Microsoft.Practices.Unity.TestSupport" }; + var namespaces = new[] { "System", "System.Collections.Generic", "Configuration.Tests" }; var assemblies = new[] { "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "Unity.TestSupport", "an invalid assembly name", "invalid, invalid" }; typeResolver = new TypeResolverImpl(aliases, namespaces, assemblies); diff --git a/tests/When_ResolvingTypesWithoutNamespacesDefined.cs b/tests/When_ResolvingTypesWithoutNamespacesDefined.cs index f799e7b..4f7dba3 100644 --- a/tests/When_ResolvingTypesWithoutNamespacesDefined.cs +++ b/tests/When_ResolvingTypesWithoutNamespacesDefined.cs @@ -22,12 +22,12 @@ namespace Microsoft.Practices.Unity.Configuration.Tests var aliases = new Dictionary { { "dict", typeof(Dictionary<,>).AssemblyQualifiedName }, - { "ILogger", "Microsoft.Practices.Unity.TestSupport.ILogger, Unity.TestSupport" }, - { "MockLogger", "Microsoft.Practices.Unity.TestSupport.MockLogger, Unity.TestSupport" } + { "ILogger", "Microsoft.Practices.Unity.TestSupport.ILogger, Configuration.Tests" }, + { "MockLogger", "Microsoft.Practices.Unity.TestSupport.MockLogger, Configuration.Tests" } }; var namespaces = new string[0]; - var assemblies = new[] { "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "Unity.TestSupport", "an invalid assembly name", "invalid, invalid" }; + var assemblies = new[] { "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "Configuration.Tests", "an invalid assembly name", "invalid, invalid" }; typeResolver = new TypeResolverImpl(aliases, namespaces, assemblies); }