public void GetAll_GetAllUsers_Users() { // Arrange var userRepository = new Mock <IRepositoryAsync <UserEntity> >(); var getUser = new GetUser( userRepository.Object); userRepository.Setup(r => r.GetAll()) .Returns(_users.AsQueryable()); // Act var result = getUser.GetAll(); // Assert Assert.NotNull(result); Assert.Equal(_users, result); Assert.Equal("Name1", result.ElementAt(0).Name); Assert.Equal("Name2", result.ElementAt(1).Name); }