Example #1
0
        public void GetGenericInterfaceImplementation_Gets_Implementation()
        {
            // Arrange
            Assembly assembly    = GetType().Assembly;
            Type     openGeneric = typeof(IGenericInterface <>);
            Type     genericArg  = typeof(int);

            Type expectedImplementation = typeof(Implementation);
            Type expectedInterface      = typeof(IGenericInterface <int>);

            var typeLocator = new TypeLocator();

            // Act
            (Type implementation, Type registrationInterface)? result = typeLocator.GetGenericInterfaceImplementation(assembly, openGeneric, genericArg);

            // Assert
            Assert.NotNull(result);
            Assert.Equal(expectedImplementation, result.Value.implementation);
            Assert.Equal(expectedInterface, result.Value.registrationInterface);
        }
Example #2
0
        public void GetGenericInterfaceImplementation_Gets_Implementation()
        {
            // Arrange
            var assembly    = GetType().Assembly;
            var openGeneric = typeof(IGenericInterface <>);
            var genericArg  = typeof(int);

            var expectedImplementation = typeof(Implementation);
            var expectedInterface      = typeof(IGenericInterface <int>);

            // Act
            var(implementation, registrationInterface) = TypeLocator.GetGenericInterfaceImplementation(
                assembly,
                openGeneric,
                genericArg
                );

            // Assert
            Assert.Equal(expectedImplementation, implementation);
            Assert.Equal(expectedInterface, registrationInterface);
        }