Inheritance: IMediator
        public void TestBindToAbstraction()
        {
            string jsonString = "[{\"Bind\":\"strange.unittests.TestView2\",\"To\":\"strange.unittests.TestMediator\",\"ToAbstraction\":\"strange.unittests.TestView\"}]";

            mediationBinder.ConsumeBindings(jsonString);
            injectionBinder.Bind <ClassToBeInjected> ().To <ClassToBeInjected> ();


            IBinding binding = mediationBinder.GetBinding <TestView2> ();

            Assert.NotNull(binding);
            Assert.AreEqual((binding as IMediationBinding).key, typeof(TestView2));

            object[] value = (binding as IMediationBinding).value as object[];
            Assert.Contains(typeof(TestMediator), value);

            TestView2 view = new TestView2();

            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.IsInstanceOf <TestView2> (mediator.view);
        }
        override protected object CreateMediator(IView view, Type mediatorType)
        {
            IMediator mediator = new TestMediator();

            mediators.Add(view, mediator);
            return(mediator);
        }
        public void TestMediatorEnabledAtCreationIfEnabled()
        {
            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;

            Assert.True(mediator.enabled);
        }
        public void TestDisableTriggersMediatorDisabled()
        {
            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.DISABLED, view);
            Assert.IsTrue(mediator.disabled);
        }
        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 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);
        }
        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);
        }
		override protected object CreateMediator(IView view, Type mediatorType)
		{
			IMediator mediator = new TestMediator ();
			mediators.Add (view, mediator);
			return mediator;
		}