protected void given_operations()
 {
     Operations = new MethodBasedOperationCreator(
         new[] { new TypeExclusionMethodFilter <object>() },
         Resolver,
         new DefaultObjectBinderLocator()).CreateOperations(new[] { TypeSystem.FromClr <THandler>() }).ToList();
 }
示例#2
0
        public void the_methods_from_the_type_are_excluded()
        {
            var filteredMethods = new TypeExclusionMethodFilter <when_filtering_methods_by_type>()
                                  .Filter(TypeSystem.FromClr <when_filtering_methods_by_type>().GetMethods());

            filteredMethods.SingleOrDefault(x => x.Name == "the_methods_from_the_type_are_excluded").ShouldBeNull();
        }
 protected void given_operations()
 {
     Operations = new MethodBasedOperationCreator(
         filters: new IMethodFilter[] { new TypeExclusionMethodFilter <object>() },
         resolver: Resolver).CreateOperations(new[] { TypeSystem.FromClr <THandler>() })
                  .ToList();
 }
        protected void given_pipeline_selectedHandler <THandler>()
        {
            if (Context.PipelineData.SelectedHandlers == null)
            {
                Context.PipelineData.SelectedHandlers = new List <IType>();
            }

            Context.PipelineData.SelectedHandlers.Add(TypeSystem.FromClr <THandler>());
        }
        object EnsureIsNotType(object resourceKey)
        {
            var resourceType = resourceKey as Type;

            if (resourceType != null)
            {
                resourceKey = TypeSystem.FromClr(resourceType);
            }
            return(resourceKey);
        }
        public void a_new_matching_is_done_and_the_resource_type_is_assigned()
        {
            given_pipeline_contributor <ResourceTypeResolverContributor>();

            given_request_uri("http://localhost/fake");
            given_registration_urimapping <Fake>("/fake");

            when_sending_notification <BootstrapperContributor>();

            Context.PipelineData.SelectedResource.ResourceKey.ShouldBe(TypeSystem.FromClr <Fake>());
        }
            protected void given_resource <T>(string template)
            {
                var resourceKey = TypeSystem.FromClr <T>();

                UriResolver.Add(new UriRegistration(template, resourceKey));
                Codecs.Add(new CodecRegistration(typeof(XmlCodec),
                                                 resourceKey,
                                                 false,
                                                 MediaType.Xml,
                                                 new[] { "xml" }, null, false));
            }
        public void the_match_is_relative_to_the_app_base_uri()
        {
            given_app_base_uri("http://localhost/root");
            given_pipeline_contributor <ResourceTypeResolverContributor>();
            given_request_uri("http://localhost/root/fake");
            given_registration_urimapping <Fake>("/fake");

            when_sending_notification <BootstrapperContributor>();

            Context.PipelineData.SelectedResource
            .ShouldNotBeNull()
            .ResourceKey.ShouldBe(TypeSystem.FromClr <Fake>());
        }
        public async Task an_interceptor_can_replace_throwing_call()
        {
            var emptyResult = new OutputMember[1]
            {
                new OutputMember()
                {
                    Member = TypeSystem.FromClr(typeof(string)), Value = "Calm down dear!"
                }
            };

            given_operation("ThrowOnCall");
            given_mock_interceptor(() => emptyResult);
            given_wrapper();
            when_creating_wrapper();
            invoking_wrapped_operation();

            InvokeResult.Single().Value.ShouldBe("Calm down dear!");
        }
 protected void given_handler <T>()
 {
     Handlers = Handlers ?? new List <IType>();
     Handlers.Add(TypeSystem.FromClr <T>());
 }
示例#11
0
 protected operation_context()
 {
     Handler = TypeSystem.FromClr <THandler>();
 }
 protected void given_registration_handler <TResource, THandler>()
 {
     Resolver.Resolve <IHandlerRepository>().AddResourceHandler(typeof(TResource).AssemblyQualifiedName,
                                                                TypeSystem.FromClr
                                                                    (typeof(THandler)));
 }