Esempio n. 1
0
        public static async Task executes_supplied_action()
        {
            var total = new ConcurrentBag <int>();
            await PopulatedEnumerable.ForEachAsync(3, x => {
                total.Add(int.Parse(x, CultureInfo.InvariantCulture));
                return(Task.CompletedTask);
            }).ForAwait();

            total.Sum().ShouldBe(6);
        }
Esempio n. 2
0
 public static void materializes_the_enumerable()
 {
     PopulatedEnumerable.Materialize().Count.ShouldBe(3);
 }
Esempio n. 3
0
 public static Task throws_on_null_action()
 {
     return(Should.ThrowAsync <ArgumentNullException>(() => PopulatedEnumerable.ForEachAsync(1, null !)));
 }
Esempio n. 4
0
 public static void does_not_filter_populated_items()
 {
     PopulatedEnumerable.WhereNotNull().ShouldBe(PopulatedEnumerable);
 }