Exemplo n.º 1
0
        protected override async Task <ComicPage[]> GetPagesAsync(ComicChapter chapter)
        {
            ComicPage[] res = null;
            if (UseStore)
            {
                res = await GetAsAsync <ComicPage[]>(chapter.TargetUrl);
            }
            if (res is null)
            {
                var remoteFetch = AppEngine.GetService <RemoteEngine>();
                if (remoteFetch != null && EnableRemote)
                {
                    res = await RemoteFetchPagesAsync(remoteFetch, chapter.TargetUrl);

                    if (res is null)
                    {
                        res = await base.GetPagesAsync(chapter);
                    }
                }
                else
                {
                    res = await base.GetPagesAsync(chapter);
                }
            }
            return(res);
        }
Exemplo n.º 2
0
        public void AddSomeServices_CallGet_MustReturnService()
        {
            AppEngine.Reset();
            AppEngine.Services.AddSingleton <A>();
            AppEngine.Services.AddScoped <B>();
            AppEngine.Services.AddTransient <C>();
            _ = AppEngine.Provider;

            Check <A>();
            Check <B>();
            Check <C>();

            void Check <T>()
            {
                var a = AppEngine.GetService(typeof(T));

                Assert.IsNotNull(a);
                Assert.IsInstanceOfType(a, typeof(T));
                a = AppEngine.GetService <T>();
                Assert.IsNotNull(a);
                a = AppEngine.GetRequiredService <T>();
                Assert.IsNotNull(a);
                a = AppEngine.GetRequiredService(typeof(T));
                Assert.IsNotNull(a);
                Assert.IsInstanceOfType(a, typeof(T));
            }
        }
Exemplo n.º 3
0
        public IActionResult Login(LoginModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            UserManager userManager = AppEngine.GetService <UserManager>();
            var         status      = userManager.PasswordSignIn(model.UserName, model.Password, true);

            ModelState.AddModelError("", "LoginModelRequired");
            return(View());
        }