public FavsController(MarvelLibraryContext context, CharacterService charService, FavService favService, ComicService comicService, AccountService accountService) { _context = context; _charService = charService; _favService = favService; _comicService = comicService; _accountService = accountService; }
/// <summary> /// Initializes a new instance of the ApiService class /// </summary> /// <param name="apiPublicKey">The public API key provided by Marvel</param> /// <param name="apiPrivateKey">The private API key provided by Marvel</param> public ApiService(string apiPublicKey, string apiPrivateKey) { _characterService = ServiceLocator.GetCharacterService(apiPublicKey, apiPrivateKey); _comicService = ServiceLocator.GetComicService(apiPublicKey, apiPrivateKey); _creatorService = ServiceLocator.GetCreatorService(apiPublicKey, apiPrivateKey); _eventService = ServiceLocator.GetEventService(apiPublicKey, apiPrivateKey); _seriesService = ServiceLocator.GetSeriesService(apiPublicKey, apiPrivateKey); _storyService = ServiceLocator.GetStoryService(apiPublicKey, apiPrivateKey); }
public void ThrowExceptionWhenComicServiceIsNull() { // Arrange ComicService comicServiceMock = null; var orderServiceMock = new Mock <IOrderService>(); //Act & Assert Assert.Throws <ArgumentNullException>(() => new ComicShop.Web.Areas.Admin.Controllers.AdminController(comicServiceMock, orderServiceMock.Object)); }
static async Task Main(string[] args) { Console.WriteLine("Comic downloader v1.0 credit to oclockvn"); var url = string.Empty; var comicConfig = new ComicConfig(); var config = new ConfigurationBuilder() .AddJsonFile("appsettings.json", true, true) .AddJsonFile("sites.json", true, true) .Build(); config.GetSection("Comic").Bind(comicConfig); var chapterSelector = config.GetSection("ChapterSelector").Value; var nameSelector = config.GetSection("NameSelector").Value; var imageSelector = config.GetSection("ImageSelector").Value; var dir = AppDomain.CurrentDomain.BaseDirectory; var browserConfig = AngleSharp.Configuration.Default.WithDefaultLoader(); var browserContext = AngleSharp.BrowsingContext.New(browserConfig); var comicService = new ComicService(new ParseService(browserContext), new StorageService()); do { Console.Write("Enter comic url or q to exit: "); url = Console.ReadLine(); if (url.IsGoodUrl()) { var host = url.GetAbsoluteHost(); var siteConfig = comicConfig.Sites.First(x => x.Host == host); await comicService.DownloadAsync(url, siteConfig.NameSelector, siteConfig.ChapterSelector, siteConfig.ImageSelector, dir); Console.Write("Continue (y/n): "); var cont = Console.ReadLine(); if (cont == "n") { break; } } }while (url != "q"); Console.Write("Press any key to close..."); }
public HomeController() { this.comicService = new ComicService(); }
public ComicTest() { _comicService = new ComicService(); }