Exemplo n.º 1
0
 public static StubRequest GetRequest()
 {
     var req = new StubRequest();
     req.Id = _random.Next();
     req.Name = Guid.NewGuid().ToString();
     req.CreatedOn = DateTime.UtcNow.Date.AddDays(_random.Next(100, 1000) * -1);
     return req;
 }
Exemplo n.º 2
0
        public static StubRequest GetRequest()
        {
            var req = new StubRequest();

            req.Id        = _random.Next();
            req.Name      = Guid.NewGuid().ToString();
            req.CreatedOn = DateTime.UtcNow.Date.AddDays(_random.Next(100, 1000) * -1);
            return(req);
        }
        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;
        }
 public virtual void StubMethod(StubRequest request, int count) { }