예제 #1
0
        public void CanProxyMethodWithOutIntPtrParameter()
        {
            IFooWithOutIntPtr o = (IFooWithOutIntPtr)generator.CreateInterfaceProxyWithoutTarget(
                typeof(IFooWithOutIntPtr), new Type[0], new SkipCallingMethodInterceptorWithOutputParams());

            Assert.IsNotNull(o);
            IntPtr i;

            o.Bar(out i);
        }
예제 #2
0
        public void CanUseOutIntPtr()
        {
            MockRepository    mocks = new MockRepository();
            IFooWithOutIntPtr mock  = mocks.StrictMock <IFooWithOutIntPtr>();
            IntPtr            parameter;

            mock.GetBar(out parameter);
            LastCall.IgnoreArguments().Return(5).OutRef(new IntPtr(3));
            mocks.ReplayAll();
            Assert.Equal(5, mock.GetBar(out parameter));
            Assert.Equal(new IntPtr(3), parameter);
            mocks.VerifyAll();
        }
예제 #3
0
        public void CanUseOutIntPtr()
        {
            IntPtr parameter;

            IFooWithOutIntPtr mock = MockRepository.Mock <IFooWithOutIntPtr>();

            mock.Expect(x => x.GetBar(out Arg <IntPtr> .Out(new IntPtr(3)).Dummy))
            .IgnoreArguments()
            .Return(5);

            Assert.Equal(5, mock.GetBar(out parameter));
            Assert.Equal(new IntPtr(3), parameter);
            mock.VerifyAllExpectations();
        }