I have a class structure like this
public class Entity
{
public int Id { get; set; }
public string Label { get; set; }
public string Description { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime ModifiedAt { get; set; }
public DateTime? DeletedAt { get; set;
}
I fill all the properties and save it to the DB, after that I get this object from the DB
var entity = CreateEntity()
SaveToDB(entity);
var entityFromDb = GetFromDB();
and try to compare the values in this way
Assert.AreEqual(entity, entityFromDb);
and the comparison is faild on the DateTime and Decimal values
Expected values to be equal.
Expected Value : Id = 28, CreatedAt = 2011-01-05T14:06:32.6874218Z, DeletedAt = null, Description = "Description", Duration = 2000m, Label = "Test Entity", ModifiedAt = 2011-01-05T14:06:32.6874218Z
Actual Value : Id = 28, CreatedAt = 2011-01-05T14:06:32.0000000, DeletedAt = null, Description = "Description", Duration = 2000.00000m, Label = "Test Entity", ModifiedAt = 2011-01-05T14:06:32.0000000
Can I compare this values in some way, but without make a comparison of each fields