示例#1
0
        public void no_custom_resource_not_found_handler()
        {
            var node = new OutputNode(typeof(Address));

            var def = node.As <IContainerModel>().ToInstance().As <IConfiguredInstance>();

            def.FindDependencyDefinitionFor <IResourceNotFoundHandler>()
            .ShouldBeNull();
        }
示例#2
0
        public void no_custom_resource_not_found_handler()
        {
            var node = new OutputNode(typeof(Address));

            var def = node.As <IContainerModel>().ToObjectDef();

            def.DependencyFor <IResourceNotFoundHandler>()
            .ShouldBeNull();
        }
示例#3
0
        public void add_a_custom_no_resource_handler()
        {
            var node = new OutputNode(typeof(Address));

            node.UseForResourceNotFound <MyFakeResourceNotHandler>();

            var def = node.As <IContainerModel>().ToInstance().As <IConfiguredInstance>();

            def.FindDependencyDefinitionFor <IResourceNotFoundHandler>()
            .ReturnedType.ShouldBe(typeof(MyFakeResourceNotHandler));
        }
示例#4
0
        public void add_a_custom_no_resource_handler()
        {
            var node = new OutputNode(typeof(Address));

            node.UseForResourceNotFound <MyFakeResourceNotHandler>();

            var def = node.As <IContainerModel>().ToObjectDef();

            def.FindDependencyDefinitionFor <IResourceNotFoundHandler>()
            .Type.ShouldEqual(typeof(MyFakeResourceNotHandler));
        }
示例#5
0
        public void SetUp()
        {
            var node = new OutputNode(typeof(Address));

            node.Add(new NewtonsoftJsonFormatter());
            node.Add(new XmlFormatter());
            node.Add(new FakeAddressWriter());

            using (var runtime = FubuRuntime.Basic())
            {
                var container = runtime.Get <IContainer>();

                container.Configure(x =>
                {
                    // Need a stand in value
                    x.For <IHttpRequest>().Use(MockRepository.GenerateMock <IHttpRequest>());
                });

                theInputBehavior =
                    container.GetInstance <OutputBehavior <Address> >(node.As <IContainerModel>().ToInstance());
            }
        }
示例#6
0
        public void implements_the_IMayHaveResourceType_interface()
        {
            var node = new OutputNode(typeof(Address));

            node.As <IMayHaveResourceType>().ResourceType().ShouldEqual(node.ResourceType);
        }
示例#7
0
 public void implements_the_IMayHaveResourceType_interface()
 {
     var node = new OutputNode(typeof(Address));
     node.As<IMayHaveResourceType>().ResourceType().ShouldEqual(node.ResourceType);
 }