コード例 #1
0
        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);
        }
コード例 #2
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));
        }
コード例 #3
0
        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));
        }