상속: IView
		public void TestEnableTriggersMediatorEnabled()
		{
			mediationBinder.Bind<TestView> ().To<TestMediator> ();
			injectionBinder.Bind<ClassToBeInjected>().To<ClassToBeInjected>();

			TestView view = new TestView ();
			mediationBinder.Trigger(MediationEvent.AWAKE, view);

			TestMediator mediator = mediationBinder.mediators[view] as TestMediator;

			mediationBinder.Trigger(MediationEvent.ENABLED, view);
			Assert.IsTrue(mediator.enabled);
		}
		public void TestAwakeTriggersInjectionForUnmappedView()
		{
			injectionBinder.Bind<ClassToBeInjected> ().To<ClassToBeInjected> ();

			TestView view = new TestView ();
			mediationBinder.Trigger (MediationEvent.AWAKE, view);

			Assert.IsNotNull (view.testInjection);
			TestMediator mediator = null;
			if (mediationBinder.mediators.ContainsKey(view))
			{
				mediator = mediationBinder.mediators [view] as TestMediator;
			}
			Assert.AreEqual (0, mediationBinder.mediators.Count);
			Assert.IsNull (mediator);
		}
		public void TestAwakeTriggersMappingAndInjection()
		{
			mediationBinder.Bind<TestView> ().To<TestMediator> ();
			injectionBinder.Bind<ClassToBeInjected> ().To<ClassToBeInjected> ();

			TestView view = new TestView ();
			mediationBinder.Trigger (MediationEvent.AWAKE, view);

			Assert.IsTrue (view.registeredWithContext);
			Assert.IsNotNull (view.testInjection);
			TestMediator mediator = mediationBinder.mediators [view] as TestMediator;
			Assert.AreEqual (1, mediationBinder.mediators.Count);
			Assert.IsNotNull (mediator);
			Assert.IsInstanceOf<TestMediator> (mediator);

			Assert.IsTrue (mediator.preregistered);
			Assert.IsTrue (mediator.registered);
			Assert.IsFalse (mediator.removed);
		}
        public void TestAwakeTriggersMappingAndInjection()
        {
            mediationBinder.Bind <TestView> ().To <TestMediator> ();
            injectionBinder.Bind <ClassToBeInjected> ().To <ClassToBeInjected> ();

            TestView view = new TestView();

            mediationBinder.Trigger(MediationEvent.AWAKE, view);

            Assert.IsTrue(view.registeredWithContext);
            Assert.IsNotNull(view.testInjection);
            TestMediator mediator = mediationBinder.mediators [view] as TestMediator;

            Assert.AreEqual(1, mediationBinder.mediators.Count);
            Assert.IsNotNull(mediator);
            Assert.IsInstanceOf <TestMediator> (mediator);

            Assert.IsTrue(mediator.preregistered);
            Assert.IsTrue(mediator.registered);
            Assert.IsFalse(mediator.removed);
        }
        protected override bool HasMediator(IView view, Type mediatorType)
        {
            TestView testView = view as TestView;

            return(testView.HasMediator);
        }
        protected override IView[] GetViews(IView view)
        {
            TestView testView = view as TestView;

            return(testView.Views);
        }
		public void TestMediatorNotEnabledAtCreatioIfDisabledn()
		{
			mediationBinder.Bind<TestView>().To<TestMediator>();
			injectionBinder.Bind<ClassToBeInjected>().To<ClassToBeInjected>();

			TestView view = new TestView();
			view.enabled = false;
			mediationBinder.Trigger(MediationEvent.AWAKE, view);

			TestMediator mediator = mediationBinder.mediators[view] as TestMediator;
			Assert.False(mediator.enabled);
		}
		public void TestInjectViews()
		{
			injectionBinder.Bind<ClassToBeInjected>().To<ClassToBeInjected>();

			TestView view = new TestView();
			IView one = new TestView();
			IView two = new TestView();
			IView three = new TestView();

			IView[] views =
			{
				view,
				one,
				two,
				three
			};

			view.Views = views;

			mediationBinder.TestInjectViewAndChildren(view);

			Assert.AreEqual(true, one.registeredWithContext);
			Assert.AreEqual(true, two.registeredWithContext);
			Assert.AreEqual(true, three.registeredWithContext);

		}
		public void TestErrorIfClassMappedToItself()
		{
			mediationBinder.Bind<TestView> ().To<TestView> ();
			injectionBinder.Bind<ClassToBeInjected> ().To<ClassToBeInjected> ();

			TestView view = new TestView ();

			TestDelegate testDelegate = delegate
			{
				mediationBinder.Trigger (MediationEvent.AWAKE, view);
			};
			MediationException ex = Assert.Throws<MediationException>(testDelegate); //Because we've mapped view to self
			Assert.AreEqual (MediationExceptionType.MEDIATOR_VIEW_STACK_OVERFLOW, ex.type);
		}
		public void TestDestroyedTriggersUnmapping()
		{
			mediationBinder.Bind<TestView> ().To<TestMediator> ();
			injectionBinder.Bind<ClassToBeInjected> ().To<ClassToBeInjected> ();

			TestView view = new TestView ();
			mediationBinder.Trigger (MediationEvent.AWAKE, view);

			TestMediator mediator = mediationBinder.mediators [view] as TestMediator;

			mediationBinder.Trigger (MediationEvent.DESTROYED, view);
			Assert.IsTrue (mediator.removed);
			Assert.AreEqual (0, mediationBinder.mediators.Count);
		}