public void AllTypes_should_be_return_greater_than_zero() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- Assembly thisAssembly = Assembly.GetExecutingAssembly(); //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- FromAssemblyDefiner instance = AssemblyScanner.FromAssembly(thisAssembly); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- instance.GetAllTypes().Count().Should().BeGreaterThan(0); }
public void AllTypes_should_be_scan_all_classes_in_given_assembly() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- Assembly thisAssembly = Assembly.GetExecutingAssembly(); //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- FromAssemblyDefiner instance = AssemblyScanner.FromAssembly(thisAssembly); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- instance.GetAllTypes().Should().Contain(typeof(SecurityService)); instance.GetAllTypes().Should().Contain(typeof(ISecurityService)); instance.GetAllTypes().Should().Contain(typeof(Product)); instance.GetAllTypes().Should().Contain(typeof(SampleDbContext)); instance.GetAllTypes().Should().Contain(typeof(AbstractDbContext)); }
public void when_use_with_filter_with_methodHasAttribute_should_work() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- // None. //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- FromAssemblyDefiner instance = AssemblyScanner.FromAssemblyInThisApplicationDirectory(); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- List <Type> scannedTypes = instance.BasedOn <IPaymentMethod>() .Filter() .MethodHasAttribute <UnitOfWorkAttribute>() .Scan(); scannedTypes.Count.Should().Be(1); scannedTypes.Should().Contain(typeof(CBankPaymentMethod)); }