public async Task SongController_Destroy_ShouldReturnRedirectWithSuccessTempData() { //Arrenge string successMessage = null; int songId = 1; var songService = this.GetAdminSongServiceBaseMock(); songService .Setup(s => s.DeleteAsync(It.IsAny <int>())) .ReturnsAsync(true); var tempDate = new Mock <ITempDataDictionary>(); tempDate.SetupSet(t => t[WebConstants.TempDataSuccessMessageKey] = It.IsAny <string>()) .Callback((string key, object message) => successMessage = message as string); var controller = new SongsController(null, songService.Object); controller.TempData = tempDate.Object; //Act var result = await controller.Destroy(songId); //Assert successMessage.Should().Be("Song has been deleted successfully"); result.Should().BeOfType <RedirectToActionResult>(); result.As <RedirectToActionResult>().ActionName.Should().Be("ListAll"); }