public void GetAllOnContactNumberRepository() { //Arrange ContactNumberRepository contactNumberRepository = new ContactNumberRepository(_config); //Act List<ContactNumber> contactNumbers = contactNumberRepository.GetAll().ToList(); //Assert CollectionAssert.AreEqual(_contactNumbers, contactNumbers); contactNumberRepository.Dispose(); }
public void DeleteOnContactRepository() { //Arrange ContactNumberRepository contactNumberRepository = new ContactNumberRepository(_config); ContactRepository contactRepository = new ContactRepository(_config, contactNumberRepository); var contactToDelete = _contacts[4]; //Act contactRepository.Delete(contactToDelete.Id); Contact contact = contactRepository.Get(contactToDelete.Id); //Assert Assert.IsNull(contact); //Assert all contact Numbers for this contact have also been removed var contactNumbers = contactNumberRepository.GetAll().Where(cn => cn.ContactId == contactToDelete.Id).ToList(); Assert.AreEqual(0, contactNumbers.Count); }