コード例 #1
0
        public void SetUp()
        {
            var node = new OutputNode(typeof(Address));

            node.Add(new JsonSerializer());
            node.Add(new XmlFormatter());
            node.Add(new FakeAddressWriter(), new SomeConditional());

            var container = StructureMapContainerFacility.GetBasicFubuContainer();

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

            var objectDef = node.As <IContainerModel>().ToObjectDef();
            var instance  = new ObjectDefInstance(objectDef);

            theInputBehavior = container.GetInstance <OutputBehavior <Address> >(instance);
        }
コード例 #2
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());
            }
        }