public void Map_pharmacy_persistence_to_pharmacy_entity_when_pharmacy_persistance_is_null() { PharmacyPersistence pharmacyPersistence = null; Assert.Throws <ArgumentNullException>(() => PharmacyMapper.MapPharmacyPersistenceToPharmacyEntity(pharmacyPersistence)); }
public void Map_pharmacy_persistence_to_pharmacy_entity() { PharmacyPersistence pharmacyPersistence = this.GetPharmacyPersistence(); MyPharmacy pharmacy = PharmacyMapper.MapPharmacyPersistenceToPharmacyEntity(pharmacyPersistence); Assert.True(IsEqualPharmacyPersistanceAndPharmacyEntity(pharmacyPersistence, pharmacy)); }
public static MyPharmacy MapPharmacyPersistenceToPharmacyEntity(PharmacyPersistence pharmacy) { if (pharmacy == null) { throw new ArgumentNullException(); } return(new MyPharmacy(pharmacy.ApiKey, pharmacy.Name, pharmacy.Url)); }
public bool Delete(Guid id) { using (DataContext _context = new DataContext()) { PharmacyPersistence pharmacy = _context.Pharmacies.Find(id); if (pharmacy == null) return false; _context.Pharmacies.Remove(pharmacy); _context.SaveChanges(); return true; } }
public static PharmacyPersistence MapPharmacyEntityToPharmacyPersistence(MyPharmacy pharmacy) { if (pharmacy == null) { return(null); } PharmacyPersistence retVal = new PharmacyPersistence() { ApiKey = pharmacy.ApiKey, Name = pharmacy.Name, Url = pharmacy.Url }; return(retVal); }
private bool IsEqualPharmacyPersistanceAndPharmacyEntity(PharmacyPersistence pharmacyPersistence, MyPharmacy pharmacy) { if (pharmacy.ApiKey != pharmacyPersistence.ApiKey) { return(false); } if (!pharmacy.Name.Equals(pharmacyPersistence.Name)) { return(false); } if (!pharmacy.Url.Equals(pharmacyPersistence.Url)) { return(false); } return(true); }