コード例 #1
0
        public async Task ButtonNotGoodTillDownload()
        {
            // Build a PDF file that will only download after we ask it to.
            var f    = new dummyFile();
            var data = await TestUtils.GetFileAsBytes("test.pdf");

            f.GetStream = () =>
            {
                return(Observable.Return(new StreamReader(new MemoryStream(data))));
            };
            var dc = new dummyCache();
            var vm = new FileDownloadController(f, dc);

            var pdf = new PDFFile(vm);


            // Open a single talk and see if we can see it open.
            var now = new TimePeriod(DateTime.Now, DateTime.Now + TimeSpan.FromSeconds(1000));

            var exp = new ExpandingSlideThumbViewModel(pdf, now);

            // Make sure there are no slides - also primes the pump for Rx.
            Assert.IsNull(exp.TalkAsThumbs);
            await TestUtils.SpinWait(() => exp.CanShowThumbs == false, 1000);

            // Now, make sure that things go "true" after we fire off the file.
            vm.DownloadOrUpdate.Execute(null);
            await TestUtils.SpinWait(() => exp.CanShowThumbs == true, 1000);
        }
コード例 #2
0
        public async Task ShowSlidesIsAllowed()
        {
            // Open a single talk and see if we can see it open.
            var now = new TimePeriod(DateTime.Now, DateTime.Now + TimeSpan.FromSeconds(1000));
            var pf  = (await MakeDownloaders(1))[0];

            var exp = new ExpandingSlideThumbViewModel(pf, now);

            // Make sure we are allowed to show the guys
            await TestUtils.SpinWait(() => exp.CanShowThumbs == true, 500);
        }
コード例 #3
0
        public async Task ExpandDosentHappenAutomatically()
        {
            // Open a single talk and see if we can see it open.
            var now = new TimePeriod(DateTime.Now, DateTime.Now + TimeSpan.FromSeconds(1000));
            var pf  = (await MakeDownloaders(1))[0];

            var exp = new ExpandingSlideThumbViewModel(pf, now);

            // Ok, now look to make sure it isn't expanded yet.
            await TestUtils.SpinWait(() => exp.TalkAsThumbs != null, 100, false);

            Assert.IsNull(exp.TalkAsThumbs);
        }
コード例 #4
0
        public async Task ShowSlidesInSecondTalkCausesFirstNonDownloadedToShowButton()
        {
            // The normal one, that will download and whose button we can press.

            var now = new TimePeriod(DateTime.Now, DateTime.Now + TimeSpan.FromSeconds(1000));
            var pf  = await MakeDownloaders(1);

            var exp1 = pf.Select(pdf => new ExpandingSlideThumbViewModel(pdf, now)).First();

            // The second one that will be "stuck".

            var f    = new dummyFile();
            var data = await TestUtils.GetFileAsBytes("test.pdf");

            f.GetStream = () =>
            {
                return(Observable.Return(new StreamReader(new MemoryStream(data))));
            };
            var dc = new dummyCache();
            var vm = new FileDownloadController(f, dc);

            var pdf2 = new PDFFile(vm);

            var exp2 = new ExpandingSlideThumbViewModel(pdf2, now);

            // Initialize the download guys
            Assert.IsNull(exp1.TalkAsThumbs);
            Assert.IsNull(exp2.TalkAsThumbs);

            // The first talk should have slides ready to show, and the second one not since
            // we've not started the download yet.
            await TestUtils.SpinWait(() => exp1.CanShowThumbs == true, 1000);

            await TestUtils.SpinWait(() => exp2.CanShowThumbs == false, 1000);

            // Show the thumbs for the first talk.
            exp1.ShowSlides.Execute(null);

            // And now both should be false.
            await TestUtils.SpinWait(() => exp1.CanShowThumbs == false, 1000);

            await TestUtils.SpinWait(() => exp2.CanShowThumbs == false, 1000);
        }
コード例 #5
0
        public async Task ShowSlidesInOne()
        {
            // Open a single talk and see if we can see it open.
            var now = new TimePeriod(DateTime.Now, DateTime.Now + TimeSpan.FromSeconds(1000));
            var pf  = (await MakeDownloaders(1))[0];

            var exp = new ExpandingSlideThumbViewModel(pf, now);

            // Make sure there are no slides - also primes the pump for Rx.
            Assert.IsNull(exp.TalkAsThumbs);
            await TestUtils.SpinWait(() => exp.CanShowThumbs == true, 1000);

            // Open the slides!
            exp.ShowSlides.Execute(null);

            // See if they opened!
            await TestUtils.SpinWait(() => exp.TalkAsThumbs != null, 5000);

            // And the can show thumbs should now be false.
            await TestUtils.SpinWait(() => exp.CanShowThumbs == false, 100);
        }