public async Task WhenToRunTheDeleteMethod() { _serviceMock = new Mock <ICountyService>(); _serviceMock.Setup(m => m.Delete(IdCounty)).ReturnsAsync(true); _serviceCounty = _serviceMock.Object; var result = await _serviceCounty.Delete(IdCounty); Assert.True(result); _serviceMock = new Mock <ICountyService>(); _serviceMock.Setup(m => m.Delete(It.IsAny <Guid>())).ReturnsAsync(false); _serviceCounty = _serviceMock.Object; result = await _serviceCounty.Delete(Guid.NewGuid()); Assert.False(result); }
public IActionResult DeleteConfirmed(string id) { countyService.Delete(id); return(RedirectToAction(nameof(Index))); }
public ActionResult Delete(Guid id) { countyService.Delete(id); return(RedirectToAction("Index")); }