Exemple #1
0
        public void adding_different_registry_fallback_removes_view_manager_fallback()
        {
            int callCount = 0;

            viewManager.AddViewHandler(new CallbackViewHandler(delegate(object view, Type type) {
                callCount++;
            }));
            viewManager.SetFallbackContainer(new object());
            registry.SetFallbackContainer(new object());
            container.AddChild(new SupportView());
            Assert.That(callCount, Is.EqualTo(0));
        }
Exemple #2
0
        public void SetFallbackContainer(object container)
        {
            _fallbackContainer = container;

            ContainerBinding containerBinding = _registry.SetFallbackContainer(container);

            RemoveAllHandlers(false);
            AddHandlers(containerBinding);

            _registry.FallbackContainerRemove += FallbackContainerBindingRemoved;
        }
        public void adding_fallback_should_be_found_as_parent()
        {
            object fallback = new object();

            registry.SetFallbackContainer(fallback);
            object           newView       = new SupportView();
            ContainerBinding parentBinding = registry.FindParentBinding(newView);

            Assert.That(parentBinding.Container, Is.EqualTo(fallback));
        }
		public void Test_Register_View_Calls_View_Handler()
		{
			object expectedView = null;
			Type expectedType = null;
			object actualView = new object ();
			Type actualType = actualView.GetType ();

			ContainerRegistry cr = new ContainerRegistry ();
			ViewNotifier.SetRegistry (cr);
			object container = new object ();
			cr.SetFallbackContainer (container);
			cr.GetBinding (container).AddHandler (new CallbackViewHandler (delegate(object view, Type type)
			{
				expectedType = type;
				expectedView = view;
			}));
			ViewNotifier.RegisterView (actualView);

			Assert.That (actualView, Is.EqualTo (expectedView));
			Assert.That (actualType, Is.EqualTo (expectedType));
		}
        public void Test_Register_View_Calls_View_Handler()
        {
            object expectedView = null;
            Type   expectedType = null;
            object actualView   = new object();
            Type   actualType   = actualView.GetType();

            ContainerRegistry cr = new ContainerRegistry();

            ViewNotifier.SetRegistry(cr);
            object container = new object();

            cr.SetFallbackContainer(container);
            cr.GetBinding(container).AddHandler(new CallbackViewHandler(delegate(object view, Type type)
            {
                expectedType = type;
                expectedView = view;
            }));
            ViewNotifier.RegisterView(actualView);

            Assert.That(actualView, Is.EqualTo(expectedView));
            Assert.That(actualType, Is.EqualTo(expectedType));
        }