public void DeleteContactNumberOnContactNumberService() { //arrange ContactNumberService contactNumberService = new ContactNumberService(MockUnitOfWork.Object); //act contactNumberService.Delete(testContext.ContactNumber.Id); //assert - expected exception MockContactNumberRepository.Verify(y => y.Delete(It.IsAny <Guid>())); contactNumberService.Dispose(); }
public void UpdateContactNumberToExistingContactNumbersTelephoneNumberOnContactNumberService() { //arrange ContactNumberService contactNumberService = new ContactNumberService(MockUnitOfWork.Object); //set email to that of another contact in that users Phonebook var contactNumberToUpdate = testContext.SingleContact.ContactNumbers.Where((x, i) => i == 0).FirstOrDefault(); contactNumberToUpdate.TelephoneNumber = testContext.SingleContact.ContactNumbers.Where((x, i) => i == 1).FirstOrDefault().TelephoneNumber; //act contactNumberService.Update(contactNumberToUpdate); //assert - expected exception contactNumberService.Dispose(); }
public void UpdateContactNumberOnContactNumberService() { //arrange ContactNumberService contactNumberService = new ContactNumberService(MockUnitOfWork.Object); //set email to that of another contact in that users Phonebook var contactNumberToUpdate = testContext.SingleContact.ContactNumbers.Where((x, i) => i == 0).FirstOrDefault(); contactNumberToUpdate.TelephoneNumber = contactNumberToUpdate.TelephoneNumber + "01"; //act contactNumberService.Update(contactNumberToUpdate); //assert MockContactNumberRepository.Verify(y => y.Update(It.IsAny <ContactNumber>())); contactNumberService.Dispose(); }
public void CreateNewContactOnContactNumberService() { //arrange var contactNumberToCreate = new ContactNumber { ContactId = new Guid("81c4763c-b225-4756-903a-750064167813"), Description = "Work", TelephoneNumber = "201803896534" }; ContactNumberService contactNumberService = new ContactNumberService(MockUnitOfWork.Object); //act Guid contactNumberId = contactNumberService.Create(contactNumberToCreate); //assert MockContactNumberRepository.Verify(y => y.Create(It.IsAny <ContactNumber>())); Assert.IsNotNull(contactNumberId); Assert.AreEqual(contactNumberId, contactNumberToCreate.Id); contactNumberService.Dispose(); }
public void CreateNewContactNumberForNoneExistentContactOnContactNumberService() { //arrange var contactNumberToCreate = new ContactNumber { ContactId = new Guid("720d966c-5685-45c2-b63d-1312620e1d11"), Description = "Work", TelephoneNumber = "297724563901" }; ContactNumberService contactNumberService = new ContactNumberService(MockUnitOfWork.Object); //act Guid contactNumberId = contactNumberService.Create(contactNumberToCreate); //assert contactNumberService.Dispose(); }
public void CreateContactNumberForContactWithTelephoneNumberOfExistingContactNumberOnContactNumberService() { //arrange ContactNumber contactNumberToCreate = new ContactNumber { ContactId = new Guid("81c4763c-b225-4756-903a-750064167813"), Description = "Work", TelephoneNumber = "297724563901" }; ContactNumberService contactNumberService = new ContactNumberService(MockUnitOfWork.Object); //act contactNumberService.Create(contactNumberToCreate); //assert - expect excpetion contactNumberService.Dispose(); }