public async Task AwaitPatternWithEmptySet() { var x = await Observe.Empty <int>(); Assert.AreEqual(0, x); var y = await Observe.Empty <string>(); Assert.AreEqual(null, y); }
public Observe <T> GetDeserializedCachedAndRefreshedAsync <T>(Uri url, string cacheFile) where T : class { Observe <T> sequence = Observe.Empty <T>(); if (this.storage.Exists(cacheFile)) { sequence = this.storage.LoadJsonAsync <T>(cacheFile); } return(sequence.Concat( from cache in this.GetStreamAsync(url, false).Select(Json <T> .Instance.DeserializeFromStream) from _ in this.storage.SaveJsonAsync(cacheFile, cache) select cache)); }
public void SelectNone() { Observe.Empty <int>().Select(t => t)(set => Assert.IsFalse(set.HasValue)); }