Пример #1
0
        public void CallSongModifyServiceMethodDeleteSong_WhenInvoked()
        {
            // Arrange
            var songService       = new Mock <ISongService>();
            var userService       = new Mock <IUserService>();
            var artistService     = new Mock <IArtistService>();
            var albumService      = new Mock <IAlbumService>();
            var genreService      = new Mock <IGenreService>();
            var songModifyService = new Mock <ISongModifyService>();

            songModifyService.Setup(x => x.DeleteSong(It.IsAny <Guid>()));

            var id = Guid.NewGuid();

            var sut = new SongController(
                songService.Object,
                userService.Object,
                artistService.Object,
                albumService.Object,
                genreService.Object,
                songModifyService.Object);

            // Act
            sut.DeleteSong(id);

            // Assert
            songModifyService.Verify(x => x.DeleteSong(It.IsAny <Guid>()), Times.Once);
        }
Пример #2
0
 protected void RemoveSong(int songID)
 {
     try
     {
         SongController s = new SongController();
         s.DeleteSong(songID);
     }
     catch (Exception ex)
     {
         Message.Text = GetInerException(ex).Message;
     }
 }