예제 #1
0
        public void GetTypes_ReturnsEmptyListIfNullAssemblies()
        {
            // Act
            ICollection <Type> actual = TypeUtilities.GetTypes(null, t => TypeUtilities.IsType <INotImplementedTestType>(t));

            // Assert
            Assert.Empty(actual);
        }
예제 #2
0
        public void GetTypes_ReturnsEmptyListIfNullAssemblyEntries()
        {
            // Arrange
            Assembly[] asms = new Assembly[4];

            // Act
            ICollection <Type> actual = TypeUtilities.GetTypes(asms, t => TypeUtilities.IsType <INotImplementedTestType>(t));

            // Assert
            Assert.Empty(actual);
        }
예제 #3
0
        public void GetTypes_ReturnsEmptyIfNoneFound()
        {
            // Arrange
            Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies();

            // Act
            ICollection <Type> actual = TypeUtilities.GetTypes(asms, t => TypeUtilities.IsType <INotImplementedTestType>(t));

            // Assert
            Assert.Empty(actual);
        }
예제 #4
0
        public void GetTypes_ReturnsExpectedTypes()
        {
            // Arrange
            Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies();

            // Act
            ICollection <Type> actual = TypeUtilities.GetTypes(asms, t => TypeUtilities.IsType <ITestType>(t));

            // Assert
            Assert.Equal(1, actual.Count);
            Assert.Equal(typeof(TestType), actual.Single());
        }
예제 #5
0
        public void GetInstances_CreatesExpectedInstances()
        {
            // Arrange
            var assemblies = AppDomain.CurrentDomain.GetAssemblies();

            // Act
            var actual = TypeUtilities.GetInstances <ITestType>(assemblies, t => TypeUtilities.IsType <ITestType>(t));

            // Assert
            Assert.Equal(1, actual.Count);
            Assert.IsType <TestType>(actual.Single());
        }