public void ShouldBeAbleToCallUserRepositoryonLookUpUsersWithAgeRestriction() { User user1 = new User(new LoginId("123"), null); var repositoryMock = new Moq.Mock<IUserRepository>(); repositoryMock.Setup(p => p.LookupUsers(It.IsAny<User>(), It.IsAny<AgeRange>())).Returns(new List<User> { user1 }); user1.Repository = repositoryMock.Object; IList<User> lookedupUser = user1.LookupUsers(new AgeRange()); Assert.AreEqual(1, lookedupUser.Count()); repositoryMock.VerifyAll(); }