Ejemplo n.º 1
0
        public static void Main()
        {
            var songs70s = new SongsOfThe70s();
            var songs80s = new SongsOfThe80s();
            var songs90s = new SongsOfThe90s();

            var madMike = new DiscJockey(songs70s, songs80s, songs90s);

            madMike.ShowTheSongs();
        }
Ejemplo n.º 2
0
        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
                }
            };
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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;
        }