Пример #1
0
        public void GetDerivedGenericTypes_Gets_Implementation()
        {
            // Arrange
            Assembly assembly    = GetType().Assembly;
            Type     openGeneric = typeof(BaseType <>);
            Type     genericArg  = typeof(int);

            Type expectedImplementation = typeof(DerivedType);

            var typeLocator = new TypeLocator();

            // Act
            IReadOnlyCollection <Type> results = typeLocator.GetDerivedGenericTypes(assembly, openGeneric, genericArg);

            // Assert
            Assert.NotNull(results);
            Type result = Assert.Single(results);

            Assert.Equal(expectedImplementation, result);
        }
Пример #2
0
        public void GetDerivedGenericTypes_Gets_Implementation()
        {
            // Arrange
            var assembly    = GetType().Assembly;
            var openGeneric = typeof(BaseType <>);
            var genericArg  = typeof(int);

            var expectedImplementation = typeof(DerivedType);

            // Act
            var results = TypeLocator.GetDerivedGenericTypes(
                assembly,
                openGeneric,
                genericArg
                );

            // Assert
            Assert.NotNull(results);
            var result = Assert.Single(results);

            Assert.Equal(expectedImplementation, result);
        }