Esempio n. 1
0
        public void When_layout_says_that_it_can_accept_view_registry_should_add_view_to_layout()
        {
            MockRepository  mocks        = new MockRepository();
            ILayout         mockLayout   = mocks.CreateMock <ILayout>();
            ILayoutSelector mockSelector = mocks.Stub <ILayoutSelector>();
            DemoView        view         = new DemoView();

            using (mocks.Record())
            {
                SetupResult.For(mockLayout.Name).Return("something");

                Expect.Call(mockSelector.CanAccept(mockLayout, view)).Return(true);
                Expect.Call(delegate { mockLayout.AddView(view); });
            }

            using (mocks.Playback())
            {
                DefaultLayoutRegistry registry = new DefaultLayoutRegistry(null, mockSelector);
                registry.Register(mockLayout);
                registry.AddView(view);
            }
        }