Beispiel #1
0
 public List <UserType> GetUsers(List <long> userIds)
 {
     using (var myAdapter = PersistenceLayer.GetDataAccessAdapter())
     {
         var linqMetaData = new LinqMetaData(myAdapter);
         var userEntities =
             linqMetaData.User.WithPath(prefetchPath => prefetchPath.Prefetch(u => u.UserLogin)).Where(
                 u => userIds.Contains(u.UserId)).ToList();
         if (userEntities.IsEmpty())
         {
             throw new EmptyCollectionException();
         }
         List <long> addressIds = userEntities.Select(ue => ue.HomeAddressId).ToList();
         return(_userFactory.CreateUsers(userEntities, _addressRepository.GetAddresses(addressIds)));
     }
 }
Beispiel #2
0
 public void CreateUsersThrowsExceptionWhenGivenNullUserEntities()
 {
     _mocks.ReplayAll();
     _userFactory.CreateUsers(null, new List <Address>());
     _mocks.VerifyAll();
 }