Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AreNotEqual #170

Closed
candychiu opened this issue Oct 10, 2014 · 6 comments

Comments

Projects
None yet
4 participants
@candychiu
Copy link

commented Oct 10, 2014

Is there anything that asserts two object not equivalent?

@dennisdoomen

This comment has been minimized.

Copy link
Member

commented Oct 11, 2014

Not out-of-the-box. But what you could try is to wrap a call to ShouldBeEquivalentTo in an AssertionScope like this:

public static void ShouldNotBeEquivalentTo(this object actual, object expected, string because = "", params object[] args) 
{
   bool hasMismatches = false;
   using (var scope = new AssertionScope())
   {
      actual.ShouldBeEquivalentTo(expected, options => ...);
      hasMismatches = scope.Discard().Any();
   }

   Execute.Assertion.ForCondition(hasMismatches).BecauseOf(because, args).FailWith("Expected {0} not to be equivalent to {1}, but they are");
}
@candychiu

This comment has been minimized.

Copy link
Author

commented Oct 14, 2014

Thanks. Any plan to include this in the library?

@dennisdoomen dennisdoomen added this to the v3.3 milestone Oct 14, 2014

@candychiu candychiu closed this Oct 14, 2014

@dennisdoomen dennisdoomen reopened this Oct 18, 2014

@dennisdoomen dennisdoomen removed this from the v3.3 milestone Feb 12, 2015

@RookY2K

This comment has been minimized.

Copy link

commented Feb 22, 2017

Any movement on this?

@SamerAdra

This comment has been minimized.

Copy link

commented May 5, 2018

Would love for this simple feature to be added.

@dennisdoomen

This comment has been minimized.

Copy link
Member

commented May 5, 2018

We welcome PRs ;-)

@dennisdoomen

This comment has been minimized.

Copy link
Member

commented Jun 4, 2019

Will be included in 5.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.