sangeetha k

sangeetha k

  • NA
  • 207
  • 51.4k

Why i get exception when i do assert.equal

Jul 16 2018 4:43 AM
# iget exception when i do Assert.equal in nunit testings  for two list can anyone help me out
 
 
 
Borrower result = new Borrower();
List<Borrower> brwlist = new List<Borrower>();
brwlist = new List<Borrower> {
new Borrower
{
ID = 210626,
BorrowerStatus = "",
BrwAdd1 = "Property Address line 1",
BrwAdd2 = "",
BrwCellPhoneNo = "",
Brwcity = "Palmbay",
BrwEmaillID = "",
BrwHomePhNo = "",
Brwstate = "AK",
BrwZipCode = "89874",
DateOfBirth = null,
deduction = null,
FirstName = "John",
income = null,
LastName = "Smith",
LoanID = 89191,
PropertyInfo = null,
Sequence = 1
}
};
HttpContext.Current.Session["BorrowerList"] = brwlist;
var res = _BorrowerController.BorrowerAddress() as JsonResult;
string jresult = JsonConvert.SerializeObject(res.Data);
// Borrower brw1 =(Borrower) res.Data;
Borrower dresult = JsonConvert.DeserializeObject<Borrower>(jresult);
string dres = JsonConvert.SerializeObject(brwlist);
var result1 = JsonConvert.DeserializeObject<List<Borrower>>(dres);
var actual = result1[0];
// dynamic json = JArray.Parse(dres);
// var json = JsonConvert.SerializeObject(dres);
Assert.AreEqual(dresult, actual);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
#exceptiopn i get is 
 
An exception of type 'NUnit.Framework.AssertionException' occurred in nunit.framework.dll but was not handled in user code
Additional information: Expected: <ISGN.Tempo.Entities.BorrowerDetails.Borrower>
But was: <ISGN.Tempo.Entities.BorrowerDetails.Borrower>
 
 
 

Answers (1)