public async Task TitleOnce()
        {
            var meeting = MeetingHelpers.CreateMeeting();
            var mvm     = new MeetingPageViewModel(null, meeting);

            var bogus = mvm.MeetingTitle;

            mvm.StartMeetingUpdates.Execute(null);

            await TestUtils.SpinWaitAreEqual("Meeting1", () => mvm.MeetingTitle);
        }
        public async Task LoadMeetingOnceAfterOneTrigger()
        {
            var meeting = MeetingHelpers.CreateMeeting();
            var mvm     = new MeetingPageViewModel(null, meeting);

            var bogus = mvm.MeetingTitle;

            mvm.StartMeetingUpdates.Execute(null);

            await TestUtils.SpinWaitAreEqual("Meeting1", () => mvm.MeetingTitle);

            Assert.AreEqual(1, meeting.NumberOfTimesFetched);
        }
        public async Task EmptyMeeting()
        {
            var meeting = MeetingHelpers.CreateEmptyMeeting();
            var mvm     = new MeetingPageViewModel(null, meeting);

            Assert.IsFalse(mvm.MeetingIsReadyForDisplay);

            var bogus1 = mvm.MeetingIsEmpty;
            var bogus2 = mvm.MeetingIsReadyForDisplay;

            mvm.StartMeetingUpdates.Execute(null);

            await TestUtils.SpinWaitAreEqual(true, () => mvm.MeetingIsReadyForDisplay);

            await TestUtils.SpinWaitAreEqual(true, () => mvm.MeetingIsEmpty);
        }
        public async Task CheckMeetingAgendaCached()
        {
            // Brand new meeting fetch
            var meeting = MeetingHelpers.CreateMeeting();
            var mvm     = new MeetingPageViewModel(null, meeting);

            // TODO: This lien causes a hang in the test.
            // Wait for something to happen to the talks...
            var s = await mvm.Talks.Changed
                    .FirstAsync();

            var m = await Blobs.LocalStorage.GetObject <IMeeting>(meeting.AsReferenceString()).FirstAsync();

            Assert.IsNotNull(m);
            Assert.AreEqual("Meeting 1", m.Title);
        }
        public async Task GetMeetingOnce()
        {
            // Brand new meeting fetch
            var meeting = MeetingHelpers.CreateMeeting();
            var mvm     = new MeetingPageViewModel(null, meeting);

            // This line causes a hang. :(
            // Wait for something to happen to the talks...
            var s = await mvm.Talks.Changed
                    .FirstAsync();

            Assert.IsNotNull(s);

            Assert.AreEqual(1, mvm.Talks.Count);
            Assert.AreEqual(1, meeting.NumberOfTimesFetched);
        }
        public async Task GetMeetingFromCache()
        {
            // Install the meeting in the cache.
            var meeting = MeetingHelpers.CreateMeeting();
            await Blobs.LocalStorage.InsertObject(meeting.AsReferenceString(), await meeting.GetMeeting()).FirstAsync();

            // Go grab the meeting now. It should show up twice.
            var mvm = new MeetingPageViewModel(null, meeting);

            // TODO: This await never returns below. Find a way to look
            // for talks updated!
            // CLear, and then set
            await mvm.Talks.Changed.FirstAsync();

            await mvm.Talks.Changed.FirstAsync();

            // Clear and then set.
            await mvm.Talks.Changed.FirstAsync();

            await mvm.Talks.Changed.FirstAsync();

            Assert.AreEqual(1, mvm.Talks.Count);
            Assert.AreEqual(2, meeting.NumberOfTimesFetched);
        }