Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public IActionResult DeleteConfirmed(string id)
 {
     countyService.Delete(id);
     return(RedirectToAction(nameof(Index)));
 }
Ejemplo n.º 3
0
 public ActionResult Delete(Guid id)
 {
     countyService.Delete(id);
     return(RedirectToAction("Index"));
 }