Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

PexAssumeNotNullAttribute Class

 

This attribute expresses that the governed value cannot be 'null'.

Namespace:   Microsoft.Pex.Framework
Assembly:  Microsoft.Pex.Framework (in Microsoft.Pex.Framework.dll)


[AttributeUsageAttribute(AttributeTargets::All, AllowMultiple = true, 
	Inherited = true)]
public ref class PexAssumeNotNullAttribute sealed : PexAssumeAttributeBase

NameDescription
System_CAPS_pubpropertyName

Gets the name of this package.(Inherited from PexExplorationPackageAttributeBase.)

System_CAPS_pubpropertyTypeId

(Inherited from Attribute.)

It can be attached on

  • a parameter of a parameterized test method.

    // assume foo is not null
    [PexMethod]
    public void SomeTest([PexAssumeNotNull]IFoo foo, ...) {}
    
    
  • a field,

    public class Foo {
       // this field should not be null
       [PexAssumeNotNull]
       public object Bar;
    }
    
    
  • or a type.

    // never consider null for Foo types
    [PexAssumeNotNull]
    public class Foo {}
    
    

It can also be attached to a test assembly, test fixture or test method; in this case the first arguments must indicate to which field or type the assumptions apply. When the attribute applies to a type, then it applies to all fields with this formal type.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: