Simple Cases. AssertTraffic Attribute
For simple assertions about traffic, you can use the AssertTraffic
attribute. It allows you to assert that a test allocates less than a specific number of objects or memory amount.
The main limitation of such an approach is that traffic is calculated for the entire unit test and only for allocated objects. Thus, if you want to check traffic on a specific time interval or make assertions about collected objects, you should use the Traffic type.
You can add any number of AssertTraffic
attributes in case you want to filter traffic by a number of conditions.
Example
AssertTraffic properties
Name | Type | Description |
---|---|---|
|
| Asserts the size of allocated objects in bytes. |
|
| Asserts the number of allocated objects. |
|
| Selects objects for assertions by type. |
|
| Selects objects for assertions by implemented interface. |
|
| Selects objects for assertions by namespace *. The asterisk (*) wildcard is supported. |