コード例 #1
0
        public static IMethodInvocation GetMock(StubRequest req = null, int? count = null)
        {
            var stub = new CustomKeyPrefixMethodInvocationStub();
            var method = typeof(CustomKeyPrefixMethodInvocationStub).GetMethod("StubMethod");
            if (req == null)
            {
                req = StubRequest.GetRequest();
            }
            if (count == null)
            {
                count = _random.Next();
            }
            var parms = new ParameterCollection(new object[] { req, count }, method.GetParameters(), p => true);

            var mi = new Mock<IMethodInvocation>();
            mi.Setup(x => x.MethodBase).Returns(method);
            mi.Setup(x => x.Target).Returns(stub);
            mi.Setup(x => x.Inputs).Returns(parms);
            return mi.Object;
        }
コード例 #2
0
        public static IMethodInvocation GetMock(StubRequest req = null, int?count = null)
        {
            var stub   = new CustomKeyPrefixMethodInvocationStub();
            var method = typeof(CustomKeyPrefixMethodInvocationStub).GetMethod("StubMethod");

            if (req == null)
            {
                req = StubRequest.GetRequest();
            }
            if (count == null)
            {
                count = _random.Next();
            }
            var parms = new ParameterCollection(new object[] { req, count }, method.GetParameters(), p => true);

            var mi = new Mock <IMethodInvocation>();

            mi.Setup(x => x.MethodBase).Returns(method);
            mi.Setup(x => x.Target).Returns(stub);
            mi.Setup(x => x.Inputs).Returns(parms);
            return(mi.Object);
        }