public void CreateNewContactNumberForNoneExistentContactOnContactNumberService()
        {
            //arrange
            var mockContactNumberRepository = new Mock<IContactNumberRepository>();
            var mockContactService = new Mock<IContactService>();

            var contactNumberToCreate = new ContactNumber
            {
                ContactId = new Guid("720d966c-5685-45c2-b63d-1312620e1d11"),
                Description = "Work",
                TelephoneNumber = "297724563901"
            };

            mockContactNumberRepository.Setup(x => x.GetAll()).Returns(_contactNumbers);
            mockContactService.Setup(x => x.Get(It.IsAny<Guid>())).Returns(() => null);

            ContactNumberService contactNumberService = new ContactNumberService(mockContactNumberRepository.Object, mockContactService.Object);

            //act
            Guid contactNumberId = contactNumberService.Create(contactNumberToCreate);

            //assert

            contactNumberService.Dispose();
        }
        public void CreateContactNumberForContactWithTelephoneNumberOfExistingContactNumberOnContactNumberService()
        {
            //arrange
            var mockContactNumberRepository = new Mock<IContactNumberRepository>();
            var mockContactService = new Mock<IContactService>();

            ContactNumber contactNumberToCreate = new ContactNumber
            {
                ContactId = new Guid("81c4763c-b225-4756-903a-750064167813"),
                Description = "Work",
                TelephoneNumber = "297724563901"
            };

            mockContactNumberRepository.Setup(x => x.GetAll()).Returns(_contactNumbers);
            mockContactService.Setup(x => x.Get(It.IsAny<Guid>())).Returns(_contact);

            ContactNumberService contactNumberService = new ContactNumberService(mockContactNumberRepository.Object, mockContactService.Object);

            //act
            Guid contactNumberId = contactNumberService.Create(contactNumberToCreate);

            //assert - expect excpetion

            contactNumberService.Dispose();
        }
        public void CreateNewContactOnContactNumberService()
        {
            //arrange
            var mockContactNumberRepository = new Mock<IContactNumberRepository>();
            var mockContactService = new Mock<IContactService>();

            var contactNumberToCreate = new ContactNumber { ContactId = new Guid("81c4763c-b225-4756-903a-750064167813"), Description = "Work", TelephoneNumber = "201803896534" };

            mockContactNumberRepository.Setup(x => x.GetAll()).Returns(_contactNumbers);
            mockContactService.Setup(x => x.Get(It.IsAny<Guid>())).Returns(_contact);

            ContactNumberService contactNumberService = new ContactNumberService(mockContactNumberRepository.Object, mockContactService.Object);

            //act
            Guid contactNumberId = contactNumberService.Create(contactNumberToCreate);

            //assert
            mockContactNumberRepository.Verify(y => y.Create(It.IsAny<ContactNumber>()));
            Assert.IsNotNull(contactNumberId);

            contactNumberService.Dispose();
        }
        public void UpdateContactNumberToExistingContactNumbersTelephoneNumberOnContactNumberService()
        {
            //arrange
            var mockContactNumberRepository = new Mock<IContactNumberRepository>();
            var mockContactService = new Mock<IContactService>();

            var contactNumberToUpdate = _contact.ContactNumbers[0];

            mockContactNumberRepository.Setup(x => x.GetAll()).Returns(_contactNumbers);

            ContactNumberService contactNumberService = new ContactNumberService(mockContactNumberRepository.Object, mockContactService.Object);

            //set email to that of another contact in that users Phonebook
            contactNumberToUpdate.TelephoneNumber = _contact.ContactNumbers[1].TelephoneNumber;

            //act
            contactNumberService.Update(contactNumberToUpdate);

            //assert - expected exception

            contactNumberService.Dispose();
        }
        public void UpdateContactNumberOnContactNumberService()
        {
            //arrange
            var mockContactNumberRepository = new Mock<IContactNumberRepository>();
            var mockContactService = new Mock<IContactService>();

            var contactNumberToUpdate = _contact.ContactNumbers[0];

            mockContactNumberRepository.Setup(x => x.GetAll()).Returns(_contactNumbers);

            ContactNumberService contactNumberService = new ContactNumberService(mockContactNumberRepository.Object, mockContactService.Object);

            //set email to that of another contact in that users Phonebook
            contactNumberToUpdate.TelephoneNumber = contactNumberToUpdate.TelephoneNumber + "01";

            //act
            contactNumberService.Update(contactNumberToUpdate);

            //assert
            mockContactNumberRepository.Verify(y => y.Update(It.IsAny<ContactNumber>()));

            contactNumberService.Dispose();
        }
        public void GetAllContactNumbersByContactIdOnContactNumberService()
        {
            //arrange
            var mockContactNumberRepository = new Mock<IContactNumberRepository>();
            var mockContactService = new Mock<IContactService>();

            mockContactNumberRepository.Setup(x => x.GetAll()).Returns(_contactNumbers);

            ContactNumberService contactNumberService = new ContactNumberService(mockContactNumberRepository.Object, mockContactService.Object);

            //act
            List<ContactNumber> retContactNumbers = contactNumberService.GetAllByContactId(_contact.Id).ToList();

            //assert
            CollectionAssert.AreEqual(_contact.ContactNumbers, retContactNumbers);

            contactNumberService.Dispose();
        }
        public void DeleteContactNumberOnContactNumberService()
        {
            //arrange
            var mockContactNumberRepository = new Mock<IContactNumberRepository>();
            var mockContactService = new Mock<IContactService>();

            mockContactNumberRepository.Setup(x => x.GetAll()).Returns(_contactNumbers);

            ContactNumberService contactNumberService = new ContactNumberService(mockContactNumberRepository.Object, mockContactService.Object);

            //act
            contactNumberService.Delete(_contactNumber.Id);

            //assert - expected exception
            mockContactNumberRepository.Verify(y => y.Delete(It.IsAny<Guid>()));

            contactNumberService.Dispose();
        }