Skip to content

Integer Assert.That(i, Is.Even);/Assert.That(i, Is.Odd); and Assert.That(i, Is.MultipleOf(step)); #4945

Description

@maettu-this

Would it be possible to add Assert.That(i, Is.Even);/Assert.That(i, Is.Odd); for integers, as well as Assert.That(i, Is.MultipleOf(step));?

I am fully aware all this can be achieved by simple numerics. Still, it would be convenient and more explicitly visible what is intended:

var items = GetItems();
Assert.That(items.Length, Is.Even);
for (int i = 0; i < items.Length; i += 2)
{
    // Do something with item pairs.
}
var items = GetItems();
Assert.That(items.Length, Is.MultipleOf(3));
for (int i = 0; i < items.Length; i += 3)
{
    // Do something with item triples.
}

Metadata

Metadata

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions