public void notify_track_has_removed_added_to_play_list()
        {
            var aTrackId    = ATrack.Id;
            var aPlaylistId = APlaylist.Id;

            trackHasBeenRemovedFromPlayList.Handle(new TrackHasBeenRemovedFromPlayList(aTrackId, aPlaylistId));

            tracksNotifier.Received().NotifyTrackHasRemovedFromPlayList(aTrackId, aPlaylistId);
        }
Exemplo n.º 2
0
        public async Task notify_track_has_been_added_to_play_list_and_send_to_websocket()
        {
            var aTrackId    = ATrack.Id;
            var aPlaylistId = APlaylist.Id;
            var @event      = new TrackHasBeenAddedToPlayList(aTrackId, aPlaylistId);

            await trackHasBeenAddedToPlayList.Handle(@event);

            tracksNotifier.Received().NotifyTrackHasBeenAddedToPlayList(aTrackId, aPlaylistId);
            await websocketPort.Received().PushMessageWithEventToAll(@event);
        }
        public void add_a_track_to_a_play_list()
        {
            var aTrackId    = ATrack.Id;
            var aPlaylistId = APlaylist.Id;
            var aPlayList   = new PlayListBuilder()
                              .WithId(aPlaylistId)
                              .Build();

            playListPersistence.GetPlayList(aPlaylistId).Returns(aPlayList);

            var result = addTrackToPlayListService.Execute(aTrackId, aPlaylistId);

            result.IsRight.Should().BeTrue();
            VerifyPlayListHasBeenPersistedWith(aPlaylistId, aTrackId);
            tracksNotifier.Received().NotifyTrackHasBeenAddedToPlayList(aTrackId, aPlaylistId);
        }
        public void remove_an_existing_track_from_a_play_list()
        {
            var aTrackId    = ATrack.Id;
            var aPlaylistId = APlaylist.Id;
            var aPlayList   = new PlayListBuilder()
                              .WithId(aPlaylistId)
                              .AddTrack(new TrackBuilder()
                                        .WithId(aTrackId)
                                        .Build())
                              .Build();

            playListPersistence.GetPlayList(aPlaylistId).Returns(aPlayList);

            var result = removeTrackFromPLayListService.Execute(aTrackId, aPlaylistId);

            result.IsRight.Should().BeTrue();
            VerifyAnEmptyPlayListHasBeenPersistedWith(aPlaylistId);
            tracksNotifier.Received().NotifyTrackHasRemovedFromPlayList(aTrackId, aPlaylistId);
        }