public void FindOneNotFoundTest() { //arrange _mockContactsRepo.Setup(r => r.FindOne(It.IsAny <int>())); var service = new ContactsService(_mockContactsRepo.Object, _mockContactsMapper.Object); //act var actual = service.FindOne(1); //assert Assert.IsNull(actual); }
public void FindOneHappyPathTest() { //arrange _mockContactsRepo.Setup(r => r.FindOne(It.IsAny <int>())).Returns(contactsEntity); _mockContactsMapper.Setup(r => r.convertEntityToDTO(It.IsAny <ContactsEntity>())).Returns(contactResponseDTO); var service = new ContactsService(_mockContactsRepo.Object, _mockContactsMapper.Object); //act var actual = service.FindOne(1); //assert Assert.IsNotNull(actual); Assert.AreEqual(contactResponseDTO, actual); }