예제 #1
0
        public void FindTypesDerivedFrom_NoDerivedTypes_NullReturned()
        {
            // Act
            var types = SimplifyWebTypesFinder.FindTypesDerivedFrom <TestBootstrapper>();

            // Assert
            Assert.AreEqual(0, types.Count);
        }
        public void FindTypesDerivedFrom_TypeHave3TypesDerived_3TestControllersReturned()
        {
            // Assign

            SimplifyWebTypesFinder.ExcludedAssembliesPrefixes.Remove("Simplify");
            SimplifyWebTypesFinder.ExcludedAssembliesPrefixes.Add("DynamicProxyGenAssembly2");
            SimplifyWebTypesFinder.CleanLoadedTypesAndAssembliesInfo();

            // Act
            var types  = SimplifyWebTypesFinder.FindTypesDerivedFrom <Controller>();
            var types2 = SimplifyWebTypesFinder.FindTypesDerivedFrom <AsyncController>();

            // Assert

            Assert.AreEqual(2, types.Count);
            Assert.AreEqual(1, types2.Count);
            Assert.AreEqual("Simplify.Web.Tests.TestEntities.TestController1", types[0].FullName);
            Assert.AreEqual("Simplify.Web.Tests.TestEntities.TestController3", types[1].FullName);
            Assert.AreEqual("Simplify.Web.Tests.TestEntities.TestController2", types2[0].FullName);
        }