public void Adopt_Success() { var repo = GetMockedAdoptionRepository(); repo.Setup(x => x.Adopt(It.IsAny <Guid>(), It.IsAny <Guid>())); var service = new AdoptionService(repo.Object, null, null); var result = service.Adopt(Guid.NewGuid(), Guid.NewGuid()); Assert.IsTrue(result.Success); Assert.IsNotEmpty(result.Message); }
public void Adopt_Fail_AdoptRepositoryException() { var repo = GetMockedAdoptionRepository(); string failMessage = "Invalid ID."; repo.Setup(x => x.Adopt(It.IsAny <Guid>(), It.IsAny <Guid>())).Throws(new Exception(failMessage)); var service = new AdoptionService(repo.Object, null, null); var result = service.Adopt(Guid.NewGuid(), Guid.NewGuid()); Assert.IsFalse(result.Success); Assert.AreEqual(result.Message, failMessage); }