Exemple #1
0
        public IQueryable <TEntity> Set <TEntity>()
            where TEntity : class
        {
            if (typeof(TEntity) == typeof(Location))
            {
                return((IQueryable <TEntity>)Locations.AsQueryable());
            }

            if (typeof(TEntity) == typeof(Person))
            {
                return((IQueryable <TEntity>)Persons.AsQueryable());
            }

            if (typeof(TEntity) == typeof(RainbowType))
            {
                return((IQueryable <TEntity>)RainbowTypes.AsQueryable());
            }

            if (typeof(TEntity) == typeof(RainbowSighting))
            {
                return((IQueryable <TEntity>)RainbowSightings.AsQueryable());
            }

            throw new InvalidOperationException("Invalid entity type: " + typeof(TEntity));
        }
Exemple #2
0
 private static void SetupQueryable()
 {
     _mockRepository.Setup(r => r.Queryable <Photo>()).Returns(Photos.AsQueryable());
     _mockRepository.Setup(r => r.Queryable <Member>()).Returns(Members.AsQueryable());
     _mockRepository.Setup(r => r.Queryable <Location>()).Returns(Locations.AsQueryable());
     _mockRepository.Setup(r => r.Queryable <Event>()).Returns(Events.AsQueryable());
     _mockRepository.Setup(r => r.Queryable <Topic>()).Returns(Topics.AsQueryable());
     _mockRepository.Setup(r => r.Queryable <Story>()).Returns(Stories.AsQueryable());
 }