コード例 #1
0
        static bool CanBeConfigured(IndirectionStubSpecimen stub)
        {
            var dlgtMethod = stub.IndirectionDelegateMethod;

            return(!dlgtMethod.IsGenericMethod &&
                   !dlgtMethod.HasRefParameters() &&
                   (!dlgtMethod.IsVoid() || dlgtMethod.HasOutParameters()));
        }
コード例 #2
0
        public void AddStub(IndirectionStubSpecimen stub)
        {
            if (stub == null)
            {
                throw new ArgumentNullException("stub");
            }

            m_stubs.Add(stub);
        }
コード例 #3
0
        void SetAutoBody(IndirectionStubSpecimen stub, ISpecimenContext context)
        {
            var proxy      = default(MockProxy);
            var dlgtType   = default(Type);
            var dlgtMethod = default(MethodInfo);

            using (InstanceGetters.DisableProcessing())
            {
                dlgtType   = stub.IndirectionDelegate;
                dlgtMethod = stub.IndirectionDelegateMethod;
            }
            proxy = GetAutoMock(dlgtType, dlgtMethod, context);
            stub.SetBody(proxy.Object);

            using (InstanceGetters.DisableProcessing())
                m_ms.Assign(stub.CallableTarget, proxy);
        }