public void Be_Able_To_Scan_For_Abstract_Types() { // Arrange bool typeWasFound = false; // Act var configuration = new TypeScannerConfiguration(); configuration.For<AbstractClassAa>() .ScanForTypesThatInheritFromThisAbstractClass() .Do( type => { if ( type == typeof ( ClassAa ) ) { typeWasFound = true; } } ); configuration.Scan(); // Assert Assert.That( typeWasFound ); }
public void Throw_An_Exception_If_The_Type_Is_Not_A_Class_When_Scanning_For_Classes_That_Inherit_A_Class() { // Act TestDelegate action = () => { var configuration = new TypeScannerConfiguration(); configuration.For<IInterfaceAbc>() .ScanForTypesThatInheritFromThisClass() .Do( type => { } ); configuration.Scan(); }; // Assert Assert.Throws<Exception>( action ); }
public void Throw_An_Exception_If_The_Type_Is_Not_An_Interface_When_Scanning_For_Implementation_Of_An_Interface() { // Act TestDelegate action = () => { var configuration = new TypeScannerConfiguration(); configuration.For<AttributeXyz>() .ScanForTypesThatImplementThisInterface() .Do( type => { } ); configuration.Scan(); }; // Assert Assert.Throws<Exception>( action ); }
public void Throw_An_Exception_If_The_Type_Is_Not_An_Attribute_When_Scanning_For_Classes_Decorated_With_An_Attribute() { // Act TestDelegate action = () => { var configuration = new TypeScannerConfiguration(); configuration.For<IInterfaceAbc>() .ScanForTypesThatAreDecoratedWithThisAttribute() .Do( type => { } ); configuration.Scan(); }; // Assert Assert.Throws<Exception>( action ); }
public void Be_Able_To_Scan_For_Implementations_Of_Interfaces() { // Arrange bool typeWasFound = false; // Act var configuration = new TypeScannerConfiguration(); configuration.For<IInterfaceAbc>() .ScanForTypesThatImplementThisInterface() .Do( type => { if ( type == typeof( ClassAbc ) ) { typeWasFound = true; } } ); configuration.Scan(); // Assert Assert.That( typeWasFound ); }
public void Be_Able_To_Scan_For_Deeply_Nested_Classes_Decorated_With_An_Attribute() { // Arrange bool typeWasFound = false; // Act var configuration = new TypeScannerConfiguration(); configuration.For<AttributeXyz>() .ScanForTypesThatAreDecoratedWithThisAttribute() .Do( type => { if ( type == typeof( ClassXyzz ) ) { typeWasFound = true; } } ); configuration.Scan(); // Assert Assert.That( typeWasFound ); }