MudassarRasool / mb-unit

Automatically exported from code.google.com/p/mb-unit
0 stars 0 forks source link

Assert.ForAll to take an Action<T> like Assert.Multiple #721

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I would like to be able to use Assert.ForAll with a syntax similar to 
Assert.Multiple. More specifically, I would like to be able to pass an 
Action<T> containing inner assertions instead of a simple Predicate<T> that 
returns true or false.

Example:

[Test]
public void ForAllWithAction()
{
   var array = new int[] { 2, 4, 6, 8, 9, 10, 12 };
   Assert.ForAll(array, i =>
   {
      Assert.AreEqual(0, i % 2);
      Assert.LessThanOrEqualTo(i, 10);
   });
}

The test should fail. Assert.ForAll should report that element #4 (=9) and #6 
(=12) do not pass the inner assertions. Failing inner assertion messages should 
obviously make their way up to the report.

Original issue reported on code.google.com by Yann.Tre...@gmail.com on 5 Sep 2010 at 4:05

GoogleCodeExporter commented 8 years ago

Original comment by Yann.Tre...@gmail.com on 20 Oct 2010 at 4:42

GoogleCodeExporter commented 8 years ago
In the attached file you can find my proposed solution to this issue.

Original comment by biv...@gmail.com on 27 Jan 2011 at 12:00

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by Yann.Tre...@gmail.com on 28 Jan 2011 at 7:04

GoogleCodeExporter commented 8 years ago
Applied.

Original comment by Yann.Tre...@gmail.com on 28 Jan 2011 at 10:28

GoogleCodeExporter commented 8 years ago

Original comment by Yann.Tre...@gmail.com on 3 Feb 2011 at 9:39