Beispiel #1
0
 public ModeCommand(TestMode mode, TestPresenter presenter, Test test, ITestView view)
     : base(() =>
     {
         presenter.EnableMode(mode);
         mode.Refresh();
         view.PlaceInMainPane(mode.ContentView);
     })
 {
     _test = test;
     _mode = mode;
 }
        public void matches_on_test()
        {
            var theTest = new Test("test1");
            var otherTest = new Test("test2");

            var subject = new ScreenLocator<Test>(theTest);

            var testView = MockRepository.GenerateMock<ITestView>();

            var modes = new TestMode[] {new PreviewMode(null, null, null)};
            var presenterThatDoesNotMatch = new TestScreen(null, null, otherTest, new TestStateManager(new TestConverter(), otherTest), null, null, null);
            var presenterThatShouldMatch = new TestScreen(null, null, theTest, new TestStateManager(new TestConverter(), theTest), null, null, null);
            var differentTypeOfPresenter = MockRepository.GenerateMock<IScreen>();

            subject.Matches(presenterThatDoesNotMatch).ShouldBeFalse();
            subject.Matches(presenterThatShouldMatch).ShouldBeTrue();
            subject.Matches(differentTypeOfPresenter).ShouldBeFalse();
        }
Beispiel #3
0
 public void SetMode(TestMode mode)
 {
     _currentMode = new ModeCommand(mode, this, _test, _view);
 }