Esempio n. 1
0
        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"));
        }
Esempio n. 2
0
        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);
        }