public bool UpdateEffectiveDate(int driverId, DateTime effectiveDate, string UserId)
{
db myentity=new myentity();
Driver driver = db.Drivers.Find(driverId);
driver.EffectiveDate = effectiveDate;
driver.LastModifiedBy = UserId;
driver.LastModifiedDate = DateTime.Now;
db.Drivers.Attach(driver);
db.Entry(driver).Property(x => x.EffectiveDate).IsModified = true;
db.Entry(driver).Property(x => x.LastModifiedBy).IsModified = true;
db.Entry(driver).Property(x => x.LastModifiedDate).IsModified = true;
return (db.SaveChanges() > 0);
}
the moq must be created for entity, can anyone say how to create a moq for this method.
and how to create moq to properties like " db.Entry(driver).Property(x => x.EffectiveDate).IsModified" .