コード例 #1
0
        public void MockDependencyProperty <D>(string dependencyPath, string propName, object value, bool overrideIfSet = true) where D : class
        {
            var dependency = MockMoq <D> .Create();

            SetPropPath(dependencyPath, dependency, overrideIfSet);
            dependency.OnGetProperty(propName).Returns(value);
        }
コード例 #2
0
        public static MockMoq <T> Create()
        {
            var instance = new MockMoq <T>();

            instance._mockObj = new Mock <T>();
            return(instance);
        }
コード例 #3
0
        public void MockDependencyMethodCall <D>(string dependencyPath, string methodName, object value, bool overrideIfSet = true) where D : class
        {
            var dependency = MockMoq <D> .Create();

            SetPropPath(dependencyPath, dependency, overrideIfSet);
            dependency.OnCall(methodName).Returns(value);
        }
コード例 #4
0
        static public MockMoq <D> MockClassMethods <D, RT>(string dependencyClass, Dictionary <string, object> members) where D : class
        {
            var dependency = MockMoq <D> .Create();

            // var dependency = new Mock<D>();
            foreach (var pair in members)
            {
                var methodName  = pair.Key;
                var returnValue = pair.Value;
                dependency.OnCall(methodName).ReturnsExplicit <RT>(returnValue);
            }
            return(dependency);
        }
コード例 #5
0
 public static MockMoq <T> CreateMocked <T>() where T : class
 {
     return(MockMoq <T> .Create());
 }
コード例 #6
0
 public static MockMoq <T> AddMockedProp <T>(MockMoq <T> mockObj, string name, object value = null) where T : class
 {
     return(mockObj.SetProperty(name, value));
 }
コード例 #7
0
 public static MockMoq <object> CreateMocked()
 {
     return(MockMoq <object> .Create());
 }
コード例 #8
0
 protected MockMoq <TM> CreateMocked <TM>() where TM : class
 {
     return(MockMoq <TM> .Create());
 }
コード例 #9
0
 public DbMocker(MockMoq <DbSet <T> > userDbSet, IEnumerable <T> dataSet) : this(userDbSet, dataSet.AsQueryable())
 {
 }
コード例 #10
0
 public DbMocker(MockMoq <DbSet <T> > dbSet, IQueryable <T> queryableDataSet)
 {
     _dbSet            = dbSet;
     _queryableDataSet = queryableDataSet;
 }