Method AllowInstances
AllowInstances(TypeSet)
Defines that instances of any type in the provided typeSet
are allowed to exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition AllowInstances(TypeSet typeSet)
Parameters
Type | Name | Description |
---|---|---|
TypeSet | typeSet | A TypeSet containing the types of the instances that should be allowed. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Including a type in a call to AllowInstances
, will override instance restrictions defined
using a call to NoInstances(Type[], Boolean) or NoNewInstances(Type[], Boolean).
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
AllowInstances(Type[], Boolean)
Defines that instances of the provided types
(and optionally
their subclasses) are allowed to exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition AllowInstances(Type[] types, bool includeSubclasses)
Parameters
Type | Name | Description |
---|---|---|
System.Type[] | types | An array containing the System.Types of the instances that should be allowed. |
System.Boolean | includeSubclasses | Indicates whether instances of subclasses of the specified types should be checked. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Including a type in a call to AllowInstances
, will override instance restrictions defined
using a call to NoInstances(Type[], Boolean) or NoNewInstances(Type[], Boolean).
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
AllowInstances(Type[])
Defines that instances of the provided types
are allowed to exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition AllowInstances(Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System.Type[] | types | An array containing the System.Types of the instances that should be allowed. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Including a type in a call to AllowInstances
, will override instance restrictions defined
using a call to NoInstances(Type[], Boolean) or NoNewInstances(Type[], Boolean).
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
AllowInstances(Type, Boolean)
Defines that instances of the provided type
(and optionally
its subclasses) are allowed to exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition AllowInstances(Type type, bool includeSubclasses)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The System.Type of the instances that should be allowed. |
System.Boolean | includeSubclasses | Indicates whether instances of subclasses of the specified type should be checked. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Including a type in a call to AllowInstances
, will override instance restrictions defined
using a call to NoInstances(Type[], Boolean) or NoNewInstances(Type[], Boolean).
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
AllowInstances(Type)
Defines that instances of the provided type
are allowed to exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition AllowInstances(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The System.Type of the instances that should be allowed. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Including a type in a call to AllowInstances
, will override instance restrictions defined
using a call to NoInstances(Type[], Boolean) or NoNewInstances(Type[], Boolean).
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
AllowInstances(String[], Boolean)
Defines that instances of Types
that matches the provided names (and optionally
their subclasses) are allowed to exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition AllowInstances(string[] typeNames, bool includeSubclasses)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | typeNames | An array containing the type names of the instances that should be allowed. |
System.Boolean | includeSubclasses | Indicates whether instances of subclasses of the specified types should be allowed. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Including a type in a call to AllowInstances
, will override instance restrictions defined
using a call to NoInstances(Type[], Boolean) or NoNewInstances(Type[], Boolean).
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
note
The name of a Type
can end with the wildcard character '*',
which allows all types that starts with the specified text
to be matched. This can be used to include all types in a namespace
(e.g. “System.Windows.Forms.*” will include all types in
the System.Windows.Forms namespace).
AllowInstances(String[])
Defines that instances of Types
that matches the provided names
are allowed to exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition AllowInstances(string[] typeNames)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | typeNames | An array containing the names of the |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Including a type in a call to AllowInstances
, will override instance restrictions defined
using a call to NoInstances(Type[], Boolean) or NoNewInstances(Type[], Boolean).
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
note
The name of a Type
can end with the wildcard character '*',
which allows all types that starts with the specified text
to be matched. This can be used to include all types in a namespace
(e.g. “System.Windows.Forms.*” will include all types in
the System.Windows.Forms namespace).
AllowInstances(String, Boolean)
Defines that instances of Types
that matches the provided name (and optionally
their subclasses) are allowed to exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition AllowInstances(string typeName, bool includeSubclasses)
Parameters
Type | Name | Description |
---|---|---|
System.String | typeName | The type name of the instances that should be allowed. |
System.Boolean | includeSubclasses | Indicates whether instances of subclasses of the specified types should be checked. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Including a type in a call to AllowInstances
, will override instance restrictions defined
using a call to NoInstances(Type[], Boolean) or NoNewInstances(Type[], Boolean).
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
note
The name of a Type
can end with the wildcard character '*',
which allows all types that starts with the specified text
to be matched. This can be used to include all types in a namespace
(e.g. “System.Windows.Forms.*” will include all types in
the System.Windows.Forms namespace).
AllowInstances(String)
Defines that instances of Types
that matches the provided name
are allowed to exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition AllowInstances(string typeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | typeName | The type name of the instances that should be allowed. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Including a type in a call to AllowNewInstances
, will override instance restrictions defined
using a call to NoInstances(Type[], Boolean) or NoNewInstances(Type[], Boolean).
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
note
The name of a Type
can end with the wildcard character '*',
which allows all types that starts with the specified text
to be matched. This can be used to include all types in a namespace
(e.g. “System.Windows.Forms.*” will include all types in
the System.Windows.Forms namespace).