Example #1
0
        public void find_by_any_looks_at_resource_model_first_then_handler_type_second()
        {
            var candidates = new ChainSearch
            {
                TypeMode = TypeSearchMode.ResourceModelOnly,
                Type = typeof(SimpleOutputModel)
            }.FindCandidatesByType(theGraph);

            candidates.First().Select(x => x.FirstCall().Description)
                .ShouldHaveTheSameElementsAs(
                "OneController.Report() : SimpleOutputModel",
                "OneController.Query(SimpleInputModel model) : SimpleOutputModel",
                "TwoController.Report() : SimpleOutputModel",
                "TwoController.NotQuery(SimpleInputModel model) : SimpleOutputModel"

                );
        }
Example #2
0
        public void find_by_method_if_it_exists()
        {
            var candidates = new ChainSearch
            {
                TypeMode = TypeSearchMode.Any,
                Type = typeof(SimpleInputModel),
                MethodName = "DoSomething"
            }.FindCandidatesByType(theGraph);

            candidates.First().Any().ShouldBeFalse();
            candidates.Last().Single().FirstCall().Description.ShouldEqual("SimpleInputModel.DoSomething(InputModel2 model) : void");
        }
Example #3
0
        public void find_by_method_if_it_exists_2()
        {
            var candidates = new ChainSearch
            {
                TypeMode = TypeSearchMode.Any,
                Type = typeof(SimpleInputModel),
                MethodName = "Query"
            }.FindCandidatesByType(theGraph);

            candidates.First().Select(x => x.FirstCall().Description)
                .ShouldHaveTheSameElementsAs("OneController.Query(SimpleInputModel model) : SimpleOutputModel");

            candidates.Last().Any().ShouldBeFalse();
        }
Example #4
0
        public void find_by_any_looks_at_input_model_first_then_handler_type_second()
        {
            var candidates = new ChainSearch{
                TypeMode = TypeSearchMode.Any,
                Type = typeof (SimpleInputModel)
            }.FindCandidatesByType(theGraph);

            candidates.Count().ShouldEqual(2);

            candidates.First().Select(x => x.FirstCall().Description)
                .ShouldHaveTheSameElementsAs("OneController.Query(SimpleInputModel model) : SimpleOutputModel", "TwoController.NotQuery(SimpleInputModel model) : SimpleOutputModel");

            candidates.Last().Single().FirstCall().Description.ShouldEqual("SimpleInputModel.DoSomething(InputModel2 model) : void");
        }