예제 #1
0
        public void Mediator_Is_Given_NonDisplayObject_View()
        {
            float            expected = 1.5f;
            IMediatorMapping mapping  = new MediatorMapping(CreateTypeFilter(new Type[1] {
                typeof(float)
            }), typeof(LifecycleReportingMediator));
            LifecycleReportingMediator mediator = injector.InstantiateUnmapped(typeof(LifecycleReportingMediator)) as LifecycleReportingMediator;

            manager.AddMediator(mediator, expected, mapping);

            Assert.That(mediator.view, Is.EqualTo(expected));
        }
예제 #2
0
        public void Mediator_For_UIComponent_Is_Initialized()
        {
            SupportView      view    = new SupportView();
            IMediatorMapping mapping = new MediatorMapping(CreateTypeFilter(new Type[1] {
                typeof(SupportView)
            }), typeof(LifecycleReportingMediator));
            LifecycleReportingMediator mediator = injector.InstantiateUnmapped(typeof(LifecycleReportingMediator)) as LifecycleReportingMediator;

            factory.Setup(f => f.GetMediator(It.IsAny <object> (), It.IsAny <IMediatorMapping>())).Returns(mediator);
            Assert.That(mediator.initialized, Is.False);
            manager.AddMediator(mediator, view, mapping);
            container.AddChild(view);

            Assert.That(mediator.initialized, Is.True);
        }