I am trying to compare two class Objects in my unit tests but getting exception even though the fields are identical.
[TestMethod]
public async Task getResult()
{
var expectedResult = new List<myClass>(){
new myClass(){
Id = 1
Name = "updatedName"
}
}
// here I am calling POST method to update the name
// won't include the full code because of brevity
// now getting the result
var actualResult = await this.getResult(1) // getting the result of the above Id
Assert.Equal(expectedResult, actualResult)
}
Exception I get:
myClass
{
Id = 1
Name = "updatedName"
} because myClass should match, but found
myClass
{
Id = 1
Name = "updatedName"
}
I am confused as all the fields are identical, so why are they not matching?