Пример #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());
        }