예제 #1
0
        public void handler_is_called()
        {
            SupportView expected = new SupportView();
            object      actual   = null;

            viewManager.AddContainer(container);
            viewManager.AddViewHandler(new CallbackViewHandler(delegate(object view, Type type) {
                actual = view;
            }));
            container.AddChild(expected);
            Assert.That(actual, Is.EqualTo(expected));
        }
예제 #2
0
        public void addContainer_throws_if_containers_are_nested()
        {
            SupportContainer container1 = new SupportContainer();
            SupportContainer container2 = new SupportContainer();

            container1.AddChild(container2);
            viewManager.AddContainer(container1);
            viewManager.AddContainer(container2);
        }
 public void addContainer_throws_if_containers_are_nested()
 {
     Assert.Throws(typeof(Exception), new TestDelegate(() =>
     {
         SupportContainer container1 = new SupportContainer();
         SupportContainer container2 = new SupportContainer();
         container1.AddChild(container2);
         viewManager.AddContainer(container1);
         viewManager.AddContainer(container2);
     }
                                                       ));
 }
        public void fallback_handles_when_container_is_not_parent()
        {
            int callCount = 0;

            viewManager.AddViewHandler(new CallbackViewHandler(delegate(object view, Type type) {
                callCount++;
            }));
            viewManager.SetFallbackContainer(new object());
            SupportContainer newContainer = new SupportContainer();

            newContainer.AddChild(new SupportView());
            Assert.That(callCount, Is.EqualTo(1));
        }
        public void adding_and_removing_fallback_puts_back_old_handlers()
        {
            int callCount = 0;

            viewManager.AddViewHandler(new CallbackViewHandler(delegate(object view, Type type) {
                callCount++;
            }));
            SupportContainer newContainer = new SupportContainer();

            viewManager.SetFallbackContainer(new object());
            viewManager.RemoveFallbackContainer();
            newContainer.AddChild(new SupportView());
            Assert.That(callCount, Is.EqualTo(0));
        }