-
Notifications
You must be signed in to change notification settings - Fork 158
PropertyConstraint
jnm2 edited this page Jun 14, 2017
·
4 revisions
PropertyConstraint
tests for the existence of a named property on an object and then
applies a constraint test to the property value.
PropertyConstraint(string name, IConstraint baseConstraint)
Has.Property(string name)... // followed by further constraint syntax
Assert.That(someObject, Has.Property("Version").EqualTo("2.0"));
Assert.That(collection, Has.Property("Count").GreaterThan(10));
Assert.That(collection, Has.Count.GreaterThan(10);
Note: As shown in the example, certain common properties are known to NUnit and may be tested using a shorter form. The following properties are supported:
Has.Length...
Has.Count...
Has.Message...
Has.InnerException...
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