Method AllowNewInstances
AllowNewInstances(TypeSet)
Defines that new instances of any type in the provided typeSet
are allowed to exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition AllowNewInstances(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 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.
AllowNewInstances(Type[], Boolean)
Defines that new 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 AllowNewInstances(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 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.
AllowNewInstances(Type[])
Defines that new instances of the provided types
are allowed to exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition AllowNewInstances(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 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.
AllowNewInstances(Type, Boolean)
Defines that new 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 AllowNewInstances(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 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.
AllowNewInstances(Type)
Defines that new instances of the provided type
are allowed to exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition AllowNewInstances(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 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.
AllowNewInstances(String[], Boolean)
Defines that new 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 AllowNewInstances(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 checked. |
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).
AllowNewInstances(String[])
Defines that new instances of Types
that matches the provided names
are allowed to exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition AllowNewInstances(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 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).
AllowNewInstances(String, Boolean)
Defines that new 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 AllowNewInstances(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 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).
AllowNewInstances(String)
Defines that new instances of Types
that matches the provided name
are allowed to exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition AllowNewInstances(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).