Ejemplo 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);
        }
Ejemplo n.º 2
0
 public static void materializes_the_enumerable()
 {
     PopulatedEnumerable.Materialize().Count.ShouldBe(3);
 }
Ejemplo n.º 3
0
 public static Task throws_on_null_action()
 {
     return(Should.ThrowAsync <ArgumentNullException>(() => PopulatedEnumerable.ForEachAsync(1, null !)));
 }
Ejemplo n.º 4
0
 public static void does_not_filter_populated_items()
 {
     PopulatedEnumerable.WhereNotNull().ShouldBe(PopulatedEnumerable);
 }