-
Notifications
You must be signed in to change notification settings - Fork 157
OrConstraint
Mikkel Nylander Bundgaard edited this page Aug 15, 2018
·
8 revisions
OrConstraint combines two other constraints and succeeds if either of them succeeds.
OrConstraint(Constraint left, Constraint right)
<Constraint>.Or.<Constraint>
Assert.That(3, Is.LessThan(5).Or.GreaterThan(10));
Note that the constraint evaluates the sub-constraints left to right, meaning that Assert.That(i, Is.Null.Or.GreaterThan(9));
where i
is a nullable int
will work for both 12
and null
. On the other hand,
Assert.That(i, Is.GreaterThan(9).Or.Null);
will only work for 12
, but throw an exception for null
, as null
cannot be compared to 9
.
The OrConstraint has precedence over the AndConstraint.
Copyright (c) 2018 The NUnit Project - Licensed under CC BY-NC-SA 4.0
-
NUnit
-
Release Notes
-
License
- Getting Started
- Writing Tests
- Running Tests
- Extending NUnit
- Technical Notes
-
Release Notes
- NUnit Xamarin Runners
- VS Test Adapter
- VS Test Generator
- NUnit Analyzers