public void CallSongServiceMethodGetSongs_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>(); var id = Guid.NewGuid(); var songCollection = new List <Song>() { new Song() { Id = id, Title = "Song Title", Album = new Album() { Title = "Album Title" }, Artist = new Artist() { Name = "Artist Name" }, Duration = 5, Genres = new List <Genre>() { new Genre() { Name = "Genre Name" } }, Lyrics = "Some Lyrics", VideoUrl = "VideoUrl" } }; songService.Setup(x => x.GetSongs()).Returns(() => songCollection.AsQueryable()); var sut = new SongController( songService.Object, userService.Object, artistService.Object, albumService.Object, genreService.Object, songModifyService.Object); // Act sut.Details(id); // Assert songService.Verify(x => x.GetSongs(), Times.Once); }
public void Index_Sets_Model_To_Correct_Song_List() { var expectedId = 2; var expectedModel = new Song(); songRepo.GetById(expectedId).Returns(expectedModel); var result = underTest.Details(expectedId); var model = (Song)result.Model; Assert.Equal(expectedModel, model); }
public void Details_Model_Is_Expected_Model() { var expectedId = 2; var expectedModel = new Song(); repo.GetById(expectedId).Returns(expectedModel); var result = sut.Details(expectedId); var model = (Song)result.Model; Assert.Equal(expectedModel, model); }
public void Details_Has_A_View() { var result = underTest.Details(1); Assert.IsType <ViewResult>(result); }