コード例 #1
0
        public void DefineMethodOverride()
        {
            var methods = ReflectionObjectMother.GetMultipeMethods(2);

            var emittableMethods = new[] { typeof(int).GetMethod("Parse", Type.EmptyTypes), typeof(bool).GetMethod("Parse") };

            _operandProvider.Expect(mock => mock.GetEmittableMethod(methods[0])).Return(emittableMethods[0]);
            _operandProvider.Expect(mock => mock.GetEmittableMethod(methods[1])).Return(emittableMethods[1]);
            _innerMock.Expect(mock => mock.DefineMethodOverride(emittableMethods[0], emittableMethods[1]));

            _decorator.DefineMethodOverride(methods[0], methods[1]);

            _operandProvider.VerifyAllExpectations();
            _innerMock.VerifyAllExpectations();
        }
コード例 #2
0
        public void DefineMethodOverride()
        {
            var methods = ReflectionObjectMother.GetMultipeMethods(2);
            var type1ParseMethodInfo = typeof(int).GetMethod("Parse", Type.EmptyTypes);
            var type2ParseMethodInfo = typeof(bool).GetMethod("Parse", new[] { typeof(string) });

            var emittableMethods = new[] { type1ParseMethodInfo, type2ParseMethodInfo };

            _operandProvider.Setup(mock => mock.GetEmittableMethod(methods[0])).Returns(emittableMethods[0]).Verifiable();
            _operandProvider.Setup(mock => mock.GetEmittableMethod(methods[1])).Returns(emittableMethods[1]).Verifiable();
            _innerMock.Setup(mock => mock.DefineMethodOverride(emittableMethods[0], emittableMethods[1])).Verifiable();

            _decorator.DefineMethodOverride(methods[0], methods[1]);

            _operandProvider.Verify();
            _innerMock.Verify();
        }