Exemple #1
0
        public void After_a_layout_is_registered_if_can_be_retrieved_by_name()
        {
            DefaultLayoutRegistry registry = new DefaultLayoutRegistry(null, null);

            registry.Register(new DemoLayout());

            Assert.IsNotNull(registry.GetLayout("Demo"));
        }
Exemple #2
0
        public void When_registering_using_framework_element_will_add_layout_decorator_for_that_element()
        {
            var panel = new DockPanel {
                Name = "Demo"
            };

            MockRepository           mocks = new MockRepository();
            ILayoutDecoratorResolver mockLayoutDecoratorResolver = mocks.CreateMock <ILayoutDecoratorResolver>();

            using (mocks.Record())
            {
                SetupResult.For(mockLayoutDecoratorResolver.GetLayoutDecoratorFor(panel))
                .Return(new DemoLayout());
            }

            using (mocks.Playback())
            {
                DefaultLayoutRegistry registry = new DefaultLayoutRegistry(mockLayoutDecoratorResolver, null);
                registry.Register(panel);
                Assert.IsNotNull(registry.GetLayout("Demo"));
            }
        }
Exemple #3
0
        public void When_trying_to_register_framework_element_that_has_no_configured_layout_will_ignore_the_registration()
        {
            var panel = new DockPanel {
                Name = "Demo"
            };

            MockRepository           mocks = new MockRepository();
            ILayoutDecoratorResolver mockLayoutDecoratorResolver = mocks.CreateMock <ILayoutDecoratorResolver>();

            using (mocks.Record())
            {
                SetupResult.For(mockLayoutDecoratorResolver.GetLayoutDecoratorFor(panel))
                .Return(null);
            }

            using (mocks.Playback())
            {
                DefaultLayoutRegistry registry = new DefaultLayoutRegistry(mockLayoutDecoratorResolver, null);
                registry.Register(panel);
                registry.GetLayout("Demo");
            }
        }
Exemple #4
0
        public void When_requesting_a_missing_layout_should_throw_meaningful_exception()
        {
            DefaultLayoutRegistry registry = new DefaultLayoutRegistry(null, null);

            registry.GetLayout("Demo");
        }