protected override void setup()
        {
            _locator = MockRepository.GenerateMock <IScreenLocator>();

            // Let's say we have a ScreenCollection with open screens
            otherActiveScreen1 = MockRepository.GenerateMock <IScreen>();
            otherActiveScreen2 = MockRepository.GenerateMock <IScreen>();
            theActiveScreen    = MockRepository.GenerateMock <IScreen>();

            Screens.Active = theActiveScreen;
            Screens.Add(otherActiveScreen1);
            Screens.Add(otherActiveScreen2);
            Screens.Add(theActiveScreen);

            // and the requested ScreenSubject does not match any of the screens
            _locator.Expect(x => x.Matches(otherActiveScreen1)).Return(false);
            _locator.Expect(x => x.Matches(otherActiveScreen2)).Return(false);
            _locator.Expect(x => x.Matches(theActiveScreen)).Return(false);

            factory = MockFor <IScreenFactory>();

            newScreen = MockRepository.GenerateMock <IScreen>();
            _locator.Expect(x => x.CreateScreen(factory)).Return(newScreen);


            TheScreenConductor.OpenScreen(_locator);
        }
Ejemplo n.º 2
0
        private IScreen createNewActiveScreen(IScreenLocator _locator)
        {
            IScreen screen = _locator.CreateScreen(_factory);

            activate(screen);
            _screens.Add(screen);
            return(screen);
        }
        protected override void setup()
        {
            _locator  = MockRepository.GenerateMock <IScreenLocator>();
            theScreen = MockRepository.GenerateMock <IScreen>();

            Screens.Active = theScreen;
            _locator.Expect(x => x.Matches(theScreen)).Return(true);

            factory = MockRepository.GenerateMock <IScreenFactory>();

            TheScreenConductor.OpenScreen(_locator);
        }
        protected override void setup()
        {
            Screens.Active.ShouldBeNull();
            _locator  = MockRepository.GenerateMock <IScreenLocator>();
            newScreen = MockRepository.GenerateMock <IScreen>();

            factory = MockFor <IScreenFactory>();

            _locator.Expect(x => x.CreateScreen(factory)).Return(newScreen);

            TheScreenConductor.OpenScreen(_locator);
        }
Ejemplo n.º 5
0
        public void Handle(DeleteTestMessage message)
        {
            IScreenLocator screenLocator = _screenObjectLocator.BuildSubject(message.Test);
            IScreen        screen        = findScreenMatchingSubject(screenLocator);

            if (screen == null)
            {
                return;
            }

            Close(screen);
        }
        protected override void setup()
        {
            _locator = MockRepository.GenerateMock <IScreenLocator>();

            // Let's say we have a ScreenCollection with open screens
            otherScreen = MockRepository.GenerateMock <IScreen>();
            theScreenThatMatchesTheSubject = MockRepository.GenerateMock <IScreen>();
            theActiveScreen = MockRepository.GenerateMock <IScreen>();

            Screens.Active = theActiveScreen;
            Screens.Add(otherScreen);
            Screens.Add(theScreenThatMatchesTheSubject);
            Screens.Add(theActiveScreen);

            // and the requested ScreenSubject does not match any of the screens
            _locator.Expect(x => x.Matches(otherScreen)).Return(false);
            _locator.Expect(x => x.Matches(theScreenThatMatchesTheSubject)).Return(true);
            _locator.Expect(x => x.Matches(theActiveScreen)).Return(false);


            TheScreenConductor.OpenScreen(_locator);
        }
Ejemplo n.º 7
0
        public virtual void OpenScreen(IScreenLocator locator)
        {
            // What if that screen is already open and active?
            if (locator.Matches(_screens.Active))
            {
                return;
            }

            // Is the requested screen one of the inactive tabs?
            IScreen screen = findScreenMatchingSubject(locator);

            if (screen == null)
            {
                screen = createNewActiveScreen(locator);
            }
            else
            {
                activate(screen);
            }

            _screens.Show(screen);
        }
Ejemplo n.º 8
0
 private IScreen findScreenMatchingSubject(IScreenLocator _locator)
 {
     return(_screens.AllScreens.FirstOrDefault(_locator.Matches));
 }
Ejemplo n.º 9
0
        public void OpenScreen <T>() where T : IScreenLocator
        {
            IScreenLocator _locator = _screenObjectLocator.BuildSubject <T>();

            OpenScreen(_locator);
        }
Ejemplo n.º 10
0
        public void OpenScreen(INamedItem subject)
        {
            IScreenLocator screenLocator = _screenObjectLocator.BuildSubject(subject);

            OpenScreen(screenLocator);
        }
Ejemplo n.º 11
0
 public IScreen Find(IScreenLocator _locator)
 {
     return _screens.AllScreens.FirstOrDefault(_locator.Matches);
 }
 public void OpenScreen(IScreenLocator _locator)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 13
0
 public IScreen Find(IScreenLocator _locator)
 {
     return(_screens.AllScreens.FirstOrDefault(_locator.Matches));
 }