public void FindImplementations_DoesNotReturnAsbtractImplementations()
        {
            var implementations = new ImplementationsFinder(_typeCacheMock.Object)
                                  .FindImplemenationsOf(typeof(IAbstract));

            Assert.Empty(implementations);
        }
        public void FindImplementations_ReturnsSingleConcreteImplementation()
        {
            var singleImplementation = new ImplementationsFinder(_typeCacheMock.Object)
                                       .FindImplemenationsOf(typeof(ISingle)).Single();

            Assert.Equal(typeof(Single), singleImplementation);
        }
        public void FindImplementations_ReturnsGenericTypes_ForSingleTypeParameter()
        {
            var implementations = new ImplementationsFinder(_typeCacheMock.Object)
                                  .FindImplemenationsOf(typeof(ISingleGeneric <>));

            var genericTypes = new[] { typeof(SingleOpenGeneric <>), typeof(SingleGeneric) };

            Assert.True(genericTypes.All(x => implementations.Contains(x)));
        }
        public void FindImplementations_ReturnsMultipleConcreteImplementations()
        {
            var implementations = new ImplementationsFinder(_typeCacheMock.Object)
                                  .FindImplemenationsOf(typeof(IMany));

            var targetTypes = new[] { typeof(FirstOfMany), typeof(SecondOfMany) };

            Assert.True(targetTypes.All(x => implementations.Contains(x)));
        }
Beispiel #5
0
        Type[] exec <T>()
        {
            AssemblyList list = new AssemblyList();

            list.AddAssemblies(GetType().Assembly);

            ImplementationsFinder finder          = new ImplementationsFinder(new TypeImplementsInterfaceValidator());
            IEnumerable <Type>    implementations = finder.FindImplementations(list, typeof(T));

            return(implementations.ToArray());
        }