public async Task SongController_ListAll_ShouldreturnViewWithSongs() { //Arrange const int TotalSongs = 2; var adminSongService = this.GetAdminSongServiceBaseMock(); adminSongService .Setup(s => s.AllAsync(It.IsAny <int>())) .ReturnsAsync(new List <AdminSongListingServiceModel> { new AdminSongListingServiceModel { Id = FirstUserId, Name = FirstUserName, Artist = FirstArtistName }, new AdminSongListingServiceModel { Id = SecondUserId, Name = SecondUserName, Artist = SecondArtistName } }); adminSongService .Setup(s => s.TotalAsync()) .ReturnsAsync(TotalSongs); var controller = new SongsController(null, adminSongService.Object); //Act var result = await controller.ListAll(1); //Assert result.Should().BeOfType <ViewResult>(); var model = result.As <ViewResult>().Model; model.Should().BeOfType <SongListingViewModel>(); var formModel = model.As <SongListingViewModel>(); formModel.AllSongs.Should().Match(s => s.Count() == 2); formModel.CurrentPage.Should().Be(1); formModel.TotalSongs.Should().Be(TotalSongs); formModel.AllSongs.First().Should().Match(s => s.As <AdminSongListingServiceModel>().Id == FirstUserId); formModel.AllSongs.First().Should().Match(s => s.As <AdminSongListingServiceModel>().Name == FirstUserName); formModel.AllSongs.First().Should().Match(s => s.As <AdminSongListingServiceModel>().Artist == FirstArtistName); formModel.AllSongs.Last().Should().Match(s => s.As <AdminSongListingServiceModel>().Id == SecondUserId); formModel.AllSongs.Last().Should().Match(s => s.As <AdminSongListingServiceModel>().Name == SecondUserName); formModel.AllSongs.Last().Should().Match(s => s.As <AdminSongListingServiceModel>().Artist == SecondArtistName); }