SameAsConstraint

jnm2 edited this page Jun 14, 2017 · 4 revisions

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));
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.