public void CanPlaySound_ThenUpdateConfig_ThenNotPlaySound() { _discJockey = new DiscJockey(new ConfigSettings { PlaySounds = false }, _audioPlayer, _speechMaker); _discJockey.PlaySounds(_projectList1Success); _discJockey.PlaySounds(_projectList1Failure); _audioPlayer.AssertWasNotCalled(a => a.Play(BrokenSound)); _discJockey.ConfigUpdated(new ConfigSettings { PlaySounds = true, BrokenBuildSound = BrokenSound}); _discJockey.PlaySounds(_projectList1Success); _discJockey.PlaySounds(_projectList1Failure); _audioPlayer.AssertWasCalled(a => a.Play(BrokenSound)); }
public ScreenUpdater(ICradiatorView view, DiscJockey discJockey, ICountdownTimer countdownTimer, IPollTimer pollTimer, BuildDataFetcher buildDataFetcher, BuildDataTransformer buildDataTransformer, FetchExceptionHandler fetchExceptionHandler, BackgroundWorker worker) { _view = view; _discJockey = discJockey; _countdownTimer = countdownTimer; _pollTimer = pollTimer; _pollTimer.Tick = (sender, e) => Update(); _fetcher = buildDataFetcher; _fetchExceptionHandler = fetchExceptionHandler; _transformer = buildDataTransformer; _worker = worker; worker.RunWorkerCompleted += DataFetched; worker.DoWork += FetchData; }
public ScreenUpdater(ICradiatorView view, DiscJockey discJockey, ICountdownTimer countdownTimer, IPollTimer pollTimer, IConfigSettings configSettings, BuildDataFetcher buildDataFetcher, BuildDataTransformer transformer, FetchExceptionHandler fetchExceptionHandler, BackgroundWorker worker) { _view = view; _discJockey = discJockey; _countdownTimer = countdownTimer; _pollTimer = pollTimer; _configSettings = configSettings; _pollTimer.Tick = (sender, e) => PollTimeup(); _fetcher = buildDataFetcher; _fetchExceptionHandler = fetchExceptionHandler; _transformer = transformer; SetLocalValuesFromConfig(configSettings); _configSettings.AddObserver(this); _worker = worker; worker.DoWork += FetchData; worker.RunWorkerCompleted += DataFetched; }
public void SetUp() { _audioPlayer = MockRepository.GenerateMock<IAudioPlayer>(); _buildBuster = MockRepository.GenerateMock<IBuildBuster>(); _configSettings = new ConfigSettings { BrokenBuildSound = BrokenSound, FixedBuildSound = FixedSound, PlaySounds = true }; _speechMaker = new SpeechMaker(_configSettings, new SpeechTextParser(_buildBuster)); _discJockey = new DiscJockey(_configSettings, _audioPlayer, _speechMaker); _projectList1Success = new List<ProjectStatus> { new ProjectStatus("bla") { LastBuildStatus = ProjectStatus.SUCCESS } }; _projectList1Failure = new List<ProjectStatus> { new ProjectStatus("bla") { LastBuildStatus = ProjectStatus.FAILURE } }; _projectList2BothSuccess = new List<ProjectStatus> { new ProjectStatus("bla") {LastBuildStatus = ProjectStatus.SUCCESS}, new ProjectStatus("bla2") {LastBuildStatus = ProjectStatus.SUCCESS} }; _projectList2BothFailure = new List<ProjectStatus> { new ProjectStatus("bla") {LastBuildStatus = ProjectStatus.FAILURE}, new ProjectStatus("bla2") {LastBuildStatus = ProjectStatus.FAILURE} }; }