Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; MenuItem has a deprecated constructor in /home/charl422/nunitsoftware.com/nunitv2/php/build_menu.php on line 34
NUnit - SameasConstraint
NUnit 2.6.5 Legacy Documentation. View NUnit 3 Documentation

Same As Constraint (NUnit 2.4)

A SameAsConstraint is used to test whether the object passed as an actual value has the same identity as the object supplied in its constructor.

Constructor

SameAsConstraint( object expected )

Syntax

Is.SameAs( object expected )

Examples of Use

Exception ex1 = new Exception();
Exception ex2 = ex1;
Assert.That( ex2, Is.SameAs( ex1 ) );

Exception ex3 = new Exception();
Assert.That( ex3, Is.Not.SameAs( ex1 ) );