public void ThrowArgumentNullException_WhenIsPassed_InvalidArgument() { // Arrange var mockedService = new Mock <IComicsService>(); var mockedMapper = new Mock <IMapper>(); var mockedFactory = new Mock <IDataModelsFactory>(); var comicsAdministrationController = new ComicsAdministrationController(mockedService.Object, mockedMapper.Object, mockedFactory.Object); // Act & Assert Assert.That(() => comicsAdministrationController.SearchComicByName(null), Throws.ArgumentNullException.With.Message.Contain("name")); }
public void Call_GetComics_FromTheService() { // Arrange var mockedService = new Mock <IComicsService>(); var mockedMapper = new Mock <IMapper>(); var mockedFactory = new Mock <IDataModelsFactory>(); mockedService.Setup(service => service.GetComic("name")); var comicsAdministrationController = new ComicsAdministrationController(mockedService.Object, mockedMapper.Object, mockedFactory.Object); // Act comicsAdministrationController.SearchComicByName("name"); // Assert mockedService.Verify(service => service.GetComic("name"), Times.Once); }