Ejemplo n.º 1
0
        public void UseRepositoryWhenRadioSongWithDeezerSongIdIsParsed()
        {
            // 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 RadioSongWithDeezerSongIdParsed(radioName, songId);

            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);
        }
Ejemplo n.º 2
0
        public void Handle(RadioSongWithDeezerSongIdParsed evt)
        {
            var song = _deezerApi.GetSong("", evt.SongId);

            StoreSong(evt.RadioName, song);
        }