public void DeleteContactOnContactService() { //arrange ContactService contactService = new ContactService(MockUnitOfWork.Object); //act contactService.Delete(testContext.SingleContact.Id); //assert - expected exception MockContactRepository.Verify(y => y.Delete(It.IsAny<Guid>()), Times.Once); contactService.Dispose(); }
public void CreateNewContactOnContactService() { //arrange var contactToCreate = new Contact { UserId = new Guid("0d1a6711-e9eb-418e-adda-47a62a7900c9"), Forename = "Carlos", Surname = "Daniels", Email = "*****@*****.**", Title = "Mr" }; ContactService contactService = new ContactService(MockUnitOfWork.Object); //act Guid contactId = contactService.Create(contactToCreate); //assert MockContactRepository.Verify(y => y.Create(It.IsAny<Contact>()), Times.Once); contactService.Dispose(); }
public void UpdateContactOnContactService() { //arrange ContactService contactService = new ContactService(MockUnitOfWork.Object); //set username to that of another user testContext.SingleContact.Email = testContext.SingleContact.Email + "WITHUPDATE"; //act contactService.Update(testContext.SingleContact); //assert MockContactRepository.Verify(y => y.Update(It.IsAny<Contact>()), Times.Once); contactService.Dispose(); }