public async Task GetAndFetchWithTestScheduler() { await new TestScheduler().With(async sched => { var settings = Locator.Current.GetService <JsonSerializerSettings>(); Assert.IsNotNull(settings); Assert.AreEqual(settings.TypeNameHandling, TypeNameHandling.All); var m = new dummyMeetingRef(); Func <Task <IMeeting> > fetcher = async() => { var x = await m.GetMeeting(); return(x); }; var blob = Blobs.LocalStorage.GetAndFetchLatest(m.AsReferenceString(), fetcher); var mtg = await blob .ToList() .FirstAsync(); Assert.IsNotNull(mtg); Assert.AreEqual(1, mtg.Count); Assert.IsNotNull(mtg.First()); }); }
public async Task GetAndFetchLatestWithItemsInThere() { var settings = Locator.Current.GetService <JsonSerializerSettings>(); Assert.IsNotNull(settings); Assert.AreEqual(settings.TypeNameHandling, TypeNameHandling.All); var m = new dummyMeetingRef(); Func <Task <IMeeting> > fetcher = async() => { var x = await m.GetMeeting(); return(x); }; await Blobs.LocalStorage.InsertObject(m.AsReferenceString(), await m.GetMeeting()); var blob = Blobs.LocalStorage.GetAndFetchLatest(m.AsReferenceString(), fetcher); var mtg = await blob .ToList() .FirstAsync(); Assert.IsNotNull(mtg); Assert.AreEqual(2, mtg.Count); Assert.IsNotNull(mtg.First()); Assert.IsNotNull(mtg.Skip(1).First()); }