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); }
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); }
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); }