public void puzzleContainer_addFacility_using_non_generic_method_and_valid_facility_should_behave_as_expected()
        {
            var container = new PuzzleContainer();

            var facility = new MyFacility();
            container.AddFacility( facility );
        }
        public void puzzleContainer_addFacility_using_non_generic_method_and_valid_facility_should_behave_as_expected()
        {
            var container = new PuzzleContainer();

            var facility = new MyFacility();

            container.AddFacility(facility);
        }
        public void puzzleContainer_addFacility_using_generic_method_and_valid_facility_should_initialize_the_new_facility()
        {
            var container = new PuzzleContainer();
            container.AddFacility<MyFacility>();
            var facility = container.GetFacilities()
                .OfType<MyFacility>()
                .Single();

            Assert.IsTrue( facility.InitializeCalled );
        }
        public void puzzleContainer_addFacility_using_generic_method_and_valid_facility_should_behave_as_expected()
        {
            var container = new PuzzleContainer();
            container.AddFacility<MyFacility>();
            var facility = container.GetFacilities()
                .OfType<MyFacility>()
                .SingleOrDefault();

            Assert.IsNotNull( facility );
        }
        public void puzzleContainer_addFacility_using_non_generic_method_and_valid_facility_should_initialize_the_new_facility()
        {
            var container = new PuzzleContainer();

            var facility = new MyFacility();

            container.AddFacility(facility);

            Assert.IsTrue(facility.InitializeCalled);
        }
        public void puzzleContainer_addFacility_using_generic_method_and_valid_facility_should_initialize_the_new_facility()
        {
            var container = new PuzzleContainer();

            container.AddFacility <MyFacility>();
            var facility = container.GetFacilities()
                           .OfType <MyFacility>()
                           .Single();

            Assert.IsTrue(facility.InitializeCalled);
        }
        public void puzzleContainer_addFacility_using_generic_method_and_valid_facility_should_behave_as_expected()
        {
            var container = new PuzzleContainer();

            container.AddFacility <MyFacility>();
            var facility = container.GetFacilities()
                           .OfType <MyFacility>()
                           .SingleOrDefault();

            Assert.IsNotNull(facility);
        }
        public void puzzleContainer_on_dispose_should_teardown_facilities()
        {
            MyFacility facility;

            using ( var container = new PuzzleContainer() )
            {
                container.AddFacility<MyFacility>();
                facility = container.GetFacilities()
                    .OfType<MyFacility>()
                    .Single();
            }

            Assert.IsTrue( facility.TeardownCalled );
        }
        public void puzzleContainer_on_dispose_should_teardown_facilities()
        {
            MyFacility facility;

            using (var container = new PuzzleContainer())
            {
                container.AddFacility <MyFacility>();
                facility = container.GetFacilities()
                           .OfType <MyFacility>()
                           .Single();
            }

            Assert.IsTrue(facility.TeardownCalled);
        }
        public void when_registering_POCO_message_handler_facility_should_correctly_subscribe_messages()
        {
            var container = new PuzzleContainer();

            container.AddFacility <SubscribeToMessageFacility>();
            container.Register(EntryBuilder.For <IMessageBroker>().UsingInstance(new MessageBroker(new NullDispatcher())));

            container.Register(EntryBuilder.For <IHandleMessage <AMessage> >().ImplementedBy <AMessageHandler>());

            var broker  = container.Resolve <IMessageBroker>();
            var handler = (AMessageHandler)container.Resolve <IHandleMessage <AMessage> >();

            broker.Dispatch(this, new AMessage());

            Assert.IsTrue(handler.Invoked);
        }
Example #11
0
        public void puzzleContainer_addFacility_using_non_generic_method_and_valid_facility_should_initialize_the_new_facility()
        {
            var container = new PuzzleContainer();

            var facility = new MyFacility();
            container.AddFacility( facility );

            Assert.IsTrue( facility.InitializeCalled );
        }
Example #12
0
 public void puzzleContainer_addFacility_using_null_reference_should_raise_ArgumentNullException()
 {
     var container = new PuzzleContainer();
     container.AddFacility( null );
 }
Example #13
0
        public void puzzleContainer_addFacility_using_null_reference_should_raise_ArgumentNullException()
        {
            var container = new PuzzleContainer();

            container.AddFacility(null);
        }