예제 #1
0
        public async Task DeleteAsyncTest()
        {
            // Arrange
            var lookup = new Category {
                Id = 1, Name = "Google"
            };

            _mockLookupRepository.Setup(x => x.FindByIdAsync(It.IsAny <int>())).ReturnsAsync(lookup);

            // Act
            var response = await _lookupService.DeleteAsync(It.IsAny <int>());

            // Assert
            _mockLookupRepository.Verify(x => x.Remove(It.IsAny <Category>()), Times.Once);
            _mockSaveRepository.Verify(x => x.CompleteAsync(), Times.Once);

            Assert.IsTrue(response.Success);
            Assert.AreEqual(string.Empty, response.Message);
        }
예제 #2
0
 public async Task Delete(string id)
 {
     await _lookupService.DeleteAsync(id);
 }
 public async Task <IActionResult> DeleteAsync(int id)
 {
     return(await GetResponse(() => _lookupService.DeleteAsync(id)));
 }