Example #1
0
        public void CallGetServiceScope_MustReturnScopeInstance()
        {
            var scope    = new NullServiceScope();
            var provider = new ValueServiceProvider
            {
                ServiceMap = new Dictionary <Type, Func <object> >
                {
                    [typeof(IServiceScopeFactory)] = () => new ValueServiceScopeFactory {
                        ScopeFactory = () => scope
                    }
                }
            };

            var retScope = ComicHostExtensions.GetServiceScope(provider);

            Assert.AreEqual(scope, retScope);
        }
        public async Task CallProx_AllMethodWasCalled()
        {
            var ss       = new NullServiceScope();
            var provider = new NullSourceProvider();
            var host     = new ComicSourceProviderHost(provider, ss);

            Assert.AreEqual(provider, host.ComicSourceProvider);
            Assert.AreEqual(ss, host.Scope);
            await host.GetChaptersAsync(string.Empty);

            await host.GetImageStreamAsync(string.Empty);

            await host.GetPagesAsync(string.Empty);

            Assert.IsTrue(provider.GetImageStreamAsyncVal);
            Assert.IsTrue(provider.GetPagesAsyncVal);
            Assert.IsTrue(provider.GetChaptersAsyncVal);
            host.Dispose();
        }