Hi Oliver,
I couldn't believe that I never have thought that :-(
Many thanks for your quick and smart answer!
Andreas
On 5 Okt., 11:09, Oliver Gramberg <oliver.gramb...@gmx.de> wrote:
> Hi Andreas,
>
> > "Assert.That(myCollection, Has.One.Matches(myCondition))".
> > How can i state such an assert with NUnit? Is it possible?
>
> maybe not natively using NUnit syntax, but if LINQ is an option, try
> something like this:
>
> IEnumerable<int> enumerable = myCollection.OfType<int>();
> int c = enumerable.Count(e => e >= 5);
> Assert.That(c, Is.EqualTo(1));
>
> or, in one go,
>
> Assert.That(myCollection.OfType<int>().Count(e => e >= 5),
> Is.EqualTo(1));
>
> Best regards,
> Oliver
--
You received this message because you are subscribed to the Google Groups "NUnit-Discuss" group.
To post to this group, send email to nunit-...@googlegroups.com.
To unsubscribe from this group, send email to nunit-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nunit-discuss?hl=en.
Quite right.
That said, should we support One or Exactly(n)?
Charlie
Charlie