public void MultipleImplementationAreRegisteredByTypeAsParameter_ResolvedCollectionContainsAllImplementations() { var adapter = new SimpleInjectorAdapter(); adapter.RegisterCollection(typeof(ITestDependency), new[] { typeof(TestDependencyA), typeof(TestDependencyB) }); var collection = adapter.Resolve <IEnumerable <ITestDependency> >().ToArray(); var firstItem = collection.First(); var secondItem = collection.Last(); Assert.IsInstanceOf(typeof(TestDependencyA), firstItem); Assert.IsInstanceOf(typeof(TestDependencyB), secondItem); }
public void MultipleImplementationAreRegisteredByInstance_ResolvedCollectionContainsAllImplementations() { var adapter = new SimpleInjectorAdapter(); var instanceA = new TestDependencyA(); var instanceB = new TestDependencyB(); adapter.RegisterCollection(new ITestDependency[] { instanceA, instanceB }); var collection = adapter.Resolve <IEnumerable <ITestDependency> >().ToArray(); var firstItem = collection.First(); var secondItem = collection.Last(); Assert.AreSame(instanceA, firstItem); Assert.AreSame(instanceB, secondItem); }