using System; namespace NUnit.Framework { /// /// Asserter that verifies two objects are different. /// public class NotSameAsserter : ComparisonAsserter { /// /// Construct a NotSameAsserter object /// /// The expected value /// The actual value /// A user-defined message for use in reporting errors /// Arguments to be used in formatting the user-defined message public NotSameAsserter( object expected, object actual, string message, params object[] args) : base( expected, actual, message, args ) { } /// /// Tests that the objects are not the same /// public override bool Test() { #if NETCF && FX1_1 //andyh return !SameAsserter.object_ReferenceEquals( expected, actual ); //throw new NotSupportedException("Assert.NotSame (ReferenceEquals) not supported on CFv1."); #else return !object.ReferenceEquals( expected, actual ); #endif } /// /// Provides a message in case of failure /// public override string Message { get { FailureMessage.AddLine( "Objects should be different" ); FailureMessage.AddLine( "\tboth are: {0}", AssertionFailureMessage.FormatObjectForDisplay( this.actual ) ); return FailureMessage.ToString(); } } } }