How to assert HttpResponseMessage content in unit test [Answered]
Let's say I have 2 variable like this:
I want to test them in unit test to see if they're equal (which I know they are but I still need to do it in the unit test), so I do something like this:
csharp
but the IDE yields
And this time, I got the error:
At this rate, I have no idea is the problem I got and how I can solve them. I'm also new to C# Unit Testing so any help from expert would be really appriciate.
I want to test them in unit test to see if they're equal (which I know they are but I still need to do it in the unit test), so I do something like this:
csharp
but the IDE yields
The EqualTo constraint always fails as the actual and the expected value cannot be equal So i tried to change it toAnd this time, I got the error:
Expected string length 29 but was 12. Strings differ at index 0.
Expected: "System.Net.Http.StringContent"
But was: "test message"
-----------^At this rate, I have no idea is the problem I got and how I can solve them. I'm also new to C# Unit Testing so any help from expert would be really appriciate.
