Click here to Skip to main content
16,018,904 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to compare 2 lists in c#?
1st list,
DBvalues = [{ "_id" : ObjectId("5d98298f9110f5f13812f3c1"), "PartName" : null, "MAP" : null, "MPN" : null, "IsActive" : true, "Gtin" : "ab085347019069" }, { "_id" : ObjectId("5d98298f9110f5f13812f3c0"), "PartName" : null, "MAP" : null, "MPN" : null, "IsActive" : true, "Gtin" : "085347014064" }]

2nd list,
actualExcelvalues = [{ "_id" : ObjectId("5d98298f9110f5f13812f3c0"), "PartName" : null, "MAP" : null, "MPN" : null, "IsActive" : true, "Gtin" : "085347014064" }, { "_id" : ObjectId("5d98298f9110f5f13812f3c1"), "PartName" : null, "MAP" : null, "MPN" : null, "IsActive" : true, "Gtin" : "ab085347019069" }]

irrespective of their order/index.

What I have tried:

Tried,
1.)CollectionAssert.AreEqual(DBvalues, actualExcelvalues);

2.) CollectionAssert.AreEquivalent(DBvalues, actualExcelvalues);
Both returns false.
Posted
Updated 21-Oct-19 12:17pm
Comments
Richard MacCutchan 19-Oct-19 4:33am    
That is JSON data, not C# list types. You need to convert it into proper C# objects to compare.
RickZeeland 19-Oct-19 5:34am    
Try again with values that are equal if you haven't done so already.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900