Beispiel #1
0
        public void should_return_all_types_with_full_name()
        {
            var pool = new TypePool();

            pool.AddType(generateType("namespace FubuMVC.Core{public class Endpoint{}}", "FubuMVC.Core.Endpoint"));
            pool.AddType(typeof(Core.Endpoint));

            pool.TypesWithFullName(typeof(Core.Endpoint).FullName).ShouldHaveCount(2);
        }
Beispiel #2
0
        private TypePool typePool()
        {
            var pool = new TypePool(GetType().Assembly);

            pool.AddType(generateType("namespace FubuMVC.Spark.Tests.SparkModel.Binding{public class Bar{}}", "FubuMVC.Spark.Tests.SparkModel.Binding.Bar"));
            pool.AddType <Bar>();
            pool.AddType <Baz>();

            return(pool);
        }
Beispiel #3
0
        public void SetUp()
        {
            matcher = new ActionSource(new ActionMethodFilter());

            pool = new TypePool(null);
            pool.IgnoreCallingAssembly();

            pool.AddType <DifferentPatternClass>();
            pool.AddType <OneController>();
            pool.AddType <TwoController>();
            pool.AddType <ThreeController>();

            calls = null;
        }
Beispiel #4
0
        private TypePool typePool()
        {
            var pool = new TypePool();

            pool.AddAssembly(GetType().Assembly);

            pool.AddType(generateType("namespace FubuMVC.Razor.Tests.RazorModel.Binding{public class Bar{}}", "FubuMVC.Razor.Tests.RazorModel.Binding.Bar"));
            pool.AddType <Bar>();
            pool.AddType <Baz>();
            pool.AddType <Generic <Baz> >();
            pool.AddType <Generic <Baz, Bar> >();

            return(pool);
        }
Beispiel #5
0
        public void SetUp()
        {
            graph   = new BehaviorGraph(null);
            matcher = new BehaviorMatcher();

            pool = new TypePool(null);
            pool.IgnoreCallingAssembly();

            pool.AddType <DifferentPatternClass>();
            pool.AddType <OneController>();
            pool.AddType <TwoController>();
            pool.AddType <ThreeController>();

            calls = null;
        }
Beispiel #6
0
        protected override void beforeEach()
        {
            theGraph = ValidationGraph.BasicGraph();
            Services.Inject(theGraph);

            theTypes = new TypePool();
            theTypes.AddType <RegistrationTargetRules>();

            Services.PartialMockTheClassUnderTest();
            ClassUnderTest.Stub(x => x.Types()).Return(theTypes);

            ClassUnderTest.Activate(new IPackageInfo[0], new PackageLog());
        }
Beispiel #7
0
        public void only_finds_methods_that_follow_the_right_pattern_and_are_not_on_object()
        {
            var pool = new TypePool(Assembly.GetExecutingAssembly());

            pool.AddType(typeof(HomeEndpoint));

            var actions = new EndpointActionSource().FindActions(pool);

            var matching = actions.Where(x => x.HandlerType == typeof(HomeEndpoint)).Select(x => x.Description);

            matching.Each(x => Debug.WriteLine(x));


            matching
            .ShouldHaveTheSameElementsAs("HomeEndpoint.Index() : HtmlDocument");
        }
        private TypePool typePool()
        {
            var pool = new TypePool(GetType().Assembly);

            var externalAssemblyDuplicatedType = generateType("namespace FubuMVC.Spark.Tests.SparkModel.Binding{public class DuplicatedGeneric<T>{}}", "FubuMVC.Spark.Tests.SparkModel.Binding.DuplicatedGeneric`1");

            pool.AddType <Bar>();
            pool.AddType <Baz>();
            pool.AddType <Generic <Baz> >();
            pool.AddType <Generic <Bar> >();
            pool.AddType <Generic <Baz, Bar> >();
            pool.AddType <DuplicatedGeneric <Bar> >();
            pool.AddSource(() => new[] { externalAssemblyDuplicatedType.Assembly, GetType().Assembly });
            pool.AddType(externalAssemblyDuplicatedType);

            return(pool);
        }
 public ActionCallCandidateExpression IncludeType <T>()
 {
     _types.AddType(typeof(T));
     _matcher.TypeFilters.Includes += type => type == typeof(T);
     return(this);
 }