0

This is the fail error I get on my xUnit with NSubstitute:

Xunit.Sdk.ContainsException
Assert.Contains() Failure
Not found: Please send my Password.
Name: Blake Lively
Phone: 7021102502
I Lost my pass, Help
In value:  Blake Lively

And this is what I have in my unit test code:

    var whatsInIt = msg.Notes;

    Assert.Contains(msg.Notes, "Blake Lively");
    Assert.Contains(msg.Notes, "7021102502");
    Assert.Contains(msg.Notes, "Help");

I wrote that whatsInIt to put a break point and see what is there before asserting it, so the value I see in is is this:

Please send my Password.
Name: Blake Lively
Phone: 7021102502
I Lost my pass, Help

So why is it still failing?

1 Answers1

1

You have your parameters backwards. Try this instead:

var whatsInIt = msg.Notes;

Assert.Contains("Blake Lively", msg.Notes);
Assert.Contains("7021102502", msg.Notes);
Assert.Contains("Help", msg.Notes);
Buddy
  • 10,874
  • 5
  • 41
  • 58