public void RegisterDbSet <TEntity>(InMemoryDbSet <TEntity> dbSet) where TEntity : class
        {
            if (dbSet == null)
            {
                throw new ArgumentNullException(nameof(dbSet));
            }

            dbSets.Add(typeof(TEntity), dbSet);
        }
        public InMemoryDbSet <TEntity> Set <TEntity>() where TEntity : class
        {
            object set;

            if (dbSets.TryGetValue(typeof(TEntity), out set))
            {
                return((InMemoryDbSet <TEntity>)set);
            }

            var dbSet = new InMemoryDbSet <TEntity>();

            dbSets[typeof(TEntity)] = dbSet;
            return(dbSet);
        }
        public override DbSet <TEntity> Set <TEntity>()
        {
            object set;

            if (dbSets.TryGetValue(typeof(TEntity), out set))
            {
                return((InMemoryDbSet <TEntity>)set);
            }

            var dbSet = new InMemoryDbSet <TEntity>();

            dbSets[typeof(TEntity)] = dbSet;
            return(dbSet);
        }
 public InMemoryRepository(IEnumerable <TEntity> entities)
 {
     dbSet = new InMemoryDbSet <TEntity>(entities);
 }