Exemple #1
0
        public async Task AwaitPatternWithEmptySet()
        {
            var x = await Observe.Empty <int>();

            Assert.AreEqual(0, x);

            var y = await Observe.Empty <string>();

            Assert.AreEqual(null, y);
        }
Exemple #2
0
        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));
        }
Exemple #3
0
 public void SelectNone()
 {
     Observe.Empty <int>().Select(t => t)(set => Assert.IsFalse(set.HasValue));
 }