public async Task Should_Return_Ok_When_Add() { //Arrange var categories = new List <CategoryRequest>(); var categoriesDTO = new List <CategoryDTO>(); var cancellationToken = new CancellationToken(); var addService = new Mock <IAdminAddService>(); var updateService = new Mock <IAdminUpdateService>(); var deleteService = new Mock <IAdminDeleteService>(); var logger = new Mock <ILogger <AdminController> >(); var mapper = new Mock <IMapper>(); mapper.Setup(m => m.Map <IEnumerable <CategoryDTO> >(categories)).Returns(categoriesDTO); addService.Setup(a => a.AddCategories(categoriesDTO, cancellationToken)); var controller = new AdminController(addService.Object, updateService.Object, deleteService.Object, logger.Object, mapper.Object); //Act var result = await controller.AddCategories(categories, cancellationToken); //Assert mapper.Verify(m => m.Map <IEnumerable <CategoryDTO> >(categories), Times.Once); addService.Verify(a => a.AddCategories(categoriesDTO, cancellationToken), Times.Once); Assert.IsType <OkResult>(result); }