Beispiel #1
0
        public void GivenNullCall_MustThrowException()
        {
            var mgr   = new NullDownloadManager();
            var saver = new NullSaver();

            Assert.ThrowsException <ArgumentNullException>(() => DownloadCenterHelper.CreateDownloadCenter(null, mgr, saver));
            Assert.ThrowsException <ArgumentNullException>(() => DownloadCenterHelper.CreateQueneDownloadCenter(null, saver));
            Assert.ThrowsException <ArgumentNullException>(() => DownloadCenterHelper.CreateDownloadCenterFromService(null));
        }
Beispiel #2
0
        public void GivenValueCreateDownloadCenter_MustReturnValue()
        {
            var mgr      = new NullDownloadManager();
            var saver    = new NullSaver();
            var provider = new ValueServiceProvider
            {
                ServiceMap = new Dictionary <Type, Func <object> >
                {
                    [typeof(IComicSaver)]      = () => saver,
                    [typeof(IDownloadManager)] = () => mgr,
                }
            };

            var center = DownloadCenterHelper.CreateDownloadCenter(
                provider, mgr, saver);

            Assert.IsNotNull(center);

            center = DownloadCenterHelper.CreateQueneDownloadCenter(provider, saver);
            Assert.IsNotNull(center);

            center = DownloadCenterHelper.CreateDownloadCenterFromService(provider);
            Assert.IsNotNull(center);
        }