Exemplo n.º 1
0
 public void CallBase_StaticContext()
 {
     Assert.That(
         () => _staticContext.CallBase(ReflectionObjectMother.GetSomeInstanceMethod()),
         Throws.InvalidOperationException
         .With.Message.EqualTo(
             "Cannot perform base call from static method."));
 }
        public void Initialization_InstanceMethodRequiresTarget()
        {
            var method = ReflectionObjectMother.GetSomeInstanceMethod();

            Assert.That(
                () => new NewDelegateExpression(typeof(Action), null, method),
                Throws.ArgumentException
                .With.ArgumentExceptionMessageEqualTo(
                    "Instance method requires target.", "target"));
        }
Exemplo n.º 3
0
        public void SetUp()
        {
            _serializableFieldFinderMock = MockRepository.GenerateStrictMock <ISerializableFieldFinder>();

            _enabler = new ProxySerializationEnabler(_serializableFieldFinderMock);

            _someProxy                    = MutableTypeObjectMother.Create(typeof(SomeType));
            _serializableProxy            = MutableTypeObjectMother.Create(typeof(SomeType), attributes: TypeAttributes.Serializable);
            _serializableInterfaceProxy   = MutableTypeObjectMother.Create(typeof(SerializableInterfaceType), copyCtorsFromBase: true);
            _deserializationCallbackProxy = MutableTypeObjectMother.Create(typeof(DeserializationCallbackType));
            _serializableInterfaceWithDeserializationCallbackProxy =
                MutableTypeObjectMother.Create(baseType: typeof(SerializableWithDeserializationCallbackType), attributes: TypeAttributes.Serializable);

            _someInitializationMethod = ReflectionObjectMother.GetSomeInstanceMethod();
        }
Exemplo n.º 4
0
        public void Initialization_InstanceMethodRequiresTarget()
        {
            var method = ReflectionObjectMother.GetSomeInstanceMethod();

            new NewDelegateExpression(typeof(Action), null, method);
        }
Exemplo n.º 5
0
 public void CallBase_StaticContext()
 {
     _staticContext.CallBase(ReflectionObjectMother.GetSomeInstanceMethod());
 }