public static LeadViewModel ToViewModel(this EM_Leads leadPOCO) { return(new LeadViewModel() { LeadID = leadPOCO.LeadID, FirstName = leadPOCO.FirstName, LastName = leadPOCO.LastName, EmailAddress = leadPOCO.EmailAddress, IsValid = leadPOCO.IsValid, Unsubscribed = leadPOCO.Unsubscribed }); }
public void AddTest() { EM_LeadsRepository target = new EM_LeadsRepository(); EM_Leads entity = null; entity = new EM_Leads(); entity.FirstName = "abc"; entity.LastName = "def"; entity.EmailAddress = "*****@*****.**"; entity.IsValid = true; entity.Unsubscribed = false; target.Add(entity); DbContextFactory.GetDbContext().SaveChanges(); EM_Leads addedEntity = target.Get(e => e.FirstName == "abc").FirstOrDefault(); Assert.That(addedEntity.FirstName, Is.EqualTo(entity.FirstName)); }