Пример #1
0
        public void Mediator_Is_Removed_From_Factory_When_View_Leaves_Stage()
        {
            int    callCount  = 0;
            object actualView = null;

            manager.ViewRemoved += (Action <object>) delegate(object eventView) {
                callCount++;
                actualView = eventView;
            };
            SupportView      view    = new SupportView();
            IMediatorMapping mapping = new MediatorMapping(CreateTypeFilter(new Type[1] {
                typeof(SupportView)
            }), typeof(CallbackMediator));
            object mediator = injector.InstantiateUnmapped(typeof(CallbackMediator));

            container.AddChild(view);
            manager.AddMediator(mediator, view, mapping);
            container.RemoveChild(view);

            Assert.That(callCount, Is.EqualTo(1));
            Assert.That(actualView, Is.EqualTo(view));
        }