コード例 #1
0
        public void Allow_Specifying_A_Custom_IAssemblyScanner()
        {
            // Arrange
            bool typeWasFound = false;

            // Act
            var configuration = new TypeScannerConfiguration();

            configuration.ScanWith( new CustomAssemblyScanner() );

            configuration.ForAllTypes()
                .Do( type =>
                {
                    if ( type == typeof( CustomAssemblyScanner ) )
                    {
                        typeWasFound = true;
                    }
                    else
                    {
                        throw new Exception( "The CustomAssemblyScanner should only return a CustomAssemblyScanner type." );
                    }
                } );

            configuration.Scan();

            // Assert
            Assert.That( typeWasFound );
        }
コード例 #2
0
        public void Be_Able_To_Scan_For_All_Types()
        {
            // Arrange
            bool typeWasFound = false;

            // Act
            var configuration = new TypeScannerConfiguration();

            configuration.ForAllTypes().Do( type =>
                {
                    if ( type == typeof( ClassA ) )
                    {
                        typeWasFound = true;
                    }
                });

            configuration.Scan();

            // Assert
            Assert.That( typeWasFound );
        }