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);
        }
        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);
        }
        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);
        }
Ejemplo n.º 4
0
 public static MockMoq <T> CreateMocked <T>() where T : class
 {
     return(MockMoq <T> .Create());
 }
 public static MockMoq <object> CreateMocked()
 {
     return(MockMoq <object> .Create());
 }
Ejemplo n.º 6
0
 protected MockMoq <TM> CreateMocked <TM>() where TM : class
 {
     return(MockMoq <TM> .Create());
 }