This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Text; | |
using Org.BouncyCastle.Asn1; | |
using Org.BouncyCastle.Asn1.Pkcs; | |
using Org.BouncyCastle.Crypto.Digests; | |
using Org.BouncyCastle.Crypto.Engines; | |
using Org.BouncyCastle.Crypto.Parameters; | |
using Org.BouncyCastle.Crypto.Signers; | |
using Org.BouncyCastle.Utilities.IO.Pem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: Raja | |
// Generic Method to translate Queryable data list into mocked DbSet Entity for Entity Framework DbContext Testing | |
private static DbSet<TEntity> GetMockedDbSetFromQueryable<TEntity>(IQueryable<TEntity> data) where TEntity : class | |
{ | |
var mockSet = new Mock<DbSet<TEntity>>(); | |
mockSet.As<IQueryable<TEntity>>().Setup(m => m.Provider).Returns(data.Provider); | |
mockSet.As<IQueryable<TEntity>>().Setup(m => m.Expression).Returns(data.Expression); | |
mockSet.As<IQueryable<TEntity>>().Setup(m => m.ElementType).Returns(data.ElementType); |