コード例 #1
0
        public static MockDbSet <TEntity> SetupSeedData <TEntity>(
            this MockDbSet <TEntity> set,
            IEnumerable <TEntity> data)
            where TEntity : class
        {
            set.AddData(data);

            return(set);
        }
コード例 #2
0
        public static MockDbSet <TEntity> SetupAddAndRemove <TEntity>(this MockDbSet <TEntity> set)
            where TEntity : class
        {
            set.Setup(s => s.Add(It.IsAny <TEntity>()))
            .Returns((TEntity t) => t)
            .Callback((TEntity t) => set.AddData(t));

            set.Setup(s => s.Remove(It.IsAny <TEntity>()))
            .Returns((TEntity t) => t)
            .Callback((TEntity t) => set.RemoveData(t));

            return(set);
        }