Create Reusable Queries
Quite often, test assertions use identical dotMemory Unit queries (say, returning a set of objects selected by some condition). In such a case, you can create a reusable query just once and use it anywhere in the code. The static QueryBuilder
class allows you to create queries that return object sets and filter traffic by specific conditions. Such queries can then be passed as a parameter to the ObjectSet.GetObjects or Traffic.Where methods.
// create reusable query
var preset = QueryBuilder.GetObjects(where => where.Generation.Is(Generation.LOH))
.GetObjects(where => where.Namespace.Like("MyNamespace*"));
dotMemory.Check(memory =>
{
// use the query
Assert.That(memory.GetObjects(preset).ObjectsCount, Is.EqualTo(0));
});
Allows creating reusable queries.
Name | Description |
---|---|
| Creates a query that gets a subset of objects by a specific condition. The condition is defined by a Returns an instance of the |
| Creates a query that gets memory traffic data by a specific condition. The condition is defined by a Returns an instance of the |