Exemple #1
0
        public void UseRepositoryWhenRadioSongIsParsed()
        {
            // arrange
            var songId    = SongId.Parse("001");
            var radioName = "djam";
            var title     = "title";
            var artist    = "artist";

            var mockedRadioSongRepository = RadioSongRepositoryBuilder.Create();
            var radioSongRepository       = mockedRadioSongRepository.Build();
            var deezerApi = DeezerApiBuilder
                            .Create()
                            .SetSong(new DeezerSong(songId, title, artist))
                            .Build();
            var radioSongHandler = new RadioSongHandler(radioSongRepository, deezerApi);
            // act
            var radioSongParsed = new RadioSongParsed(radioName, title, artist);

            radioSongHandler.Handle(radioSongParsed);
            // assert
            var(actualSongId, actualName, actualTitle, actualArtist) = mockedRadioSongRepository.RadioSongs.First();
            Assert.AreEqual(songId, actualSongId);
            Assert.AreEqual(radioName, actualName);
            Assert.AreEqual(title, actualTitle);
            Assert.AreEqual(artist, actualArtist);
        }
Exemple #2
0
        public void Handle(RadioSongParsed evt)
        {
            var song = _deezerApi.GetSong("accessToken", evt.Title, evt.Artist);

            StoreSong(evt.RadioName, song);
        }