diff --git a/AggieRent.Tests/Services/ApplicantServiceTest.cs b/AggieRent.Tests/Services/ApplicantServiceTest.cs index 4eee14b..9b6b19e 100644 --- a/AggieRent.Tests/Services/ApplicantServiceTest.cs +++ b/AggieRent.Tests/Services/ApplicantServiceTest.cs @@ -25,7 +25,7 @@ public void GetApplicantById_ValidId_ThenReturnRelatedUser() }, ]; mockApplicantRepository - .Setup(x => x.Get(It.IsAny())) + .Setup(x => x.GetVerbose(It.IsAny())) .Returns((string id) => applicants.FirstOrDefault(a => a.Id == id)); var applicantService = new ApplicantService(mockApplicantRepository.Object); @@ -42,6 +42,24 @@ public void GetApplicantById_ValidId_ThenReturnRelatedUser() OccupiedApartmentId = applicants[0].OccupiedApartmentId, }; Assert.Equivalent(expectedApplicant, returnedApplicant); + mockApplicantRepository.Verify(x => x.GetVerbose(applicants[0].Id), Times.Once()); + } + + [Fact] + public void GetApplicantById_UnknownId_ThenReturnNull() + { + var mockApplicantRepository = new Mock(); + List applicants = []; + mockApplicantRepository + .Setup(x => x.GetVerbose(It.IsAny())) + .Returns((string id) => applicants.FirstOrDefault(a => a.Id == id)); + var applicantService = new ApplicantService(mockApplicantRepository.Object); + + var idToFind = Guid.NewGuid().ToString(); + var returnedApplicant = applicantService.GetApplicantById(idToFind); + + Assert.Null(returnedApplicant); + mockApplicantRepository.Verify(x => x.GetVerbose(idToFind), Times.Once()); } } }