public async Task UpdateSeason_WhenCalled_UpdateExistingSeason() { const int id = 1; const string updateName = "2019/2020"; var seasonUpdateDto = new SeasonUpdateDto { Name = updateName }; var season = new Season { Id = id, Name = "2018/2019" }; var expectedSeason = new Season { Id = id, Name = updateName }; _seasonService.SetupSequence(s => s.GetByIdAsync(id)) .ReturnsAsync(season) .ReturnsAsync(expectedSeason); var result = await _seasonsController.UpdateSeason(id, seasonUpdateDto); var okObjectResult = result as OkObjectResult; var okObjectResultValue = okObjectResult.Value as SeasonDetailDto; _seasonService.Verify(s => s.GetByIdAsync(id), Times.Exactly(2)); _seasonService.Verify(s => s.UpdateAsync(It.IsAny <Season>()), Times.Once); Assert.That(result, Is.TypeOf <OkObjectResult>()); Assert.That(okObjectResultValue.Name, Is.EqualTo(updateName)); }