static IMethod ImplementIntoCaseConversion(this VirtualType type, IType valueType, IMethod caseCtor, bool isImplicit = true)
        {
            Debug.Assert(valueType == caseCtor.Parameters.Single().Type);
            Debug.Assert(valueType.Kind != TypeKind.Interface); // can't have conversion from interface
            Debug.Assert(valueType != type);                    // can't have conversion from itself

            var caseFactory = new VirtualMethod(type, Accessibility.Public,
                                                isImplicit ? "op_Implicit" : "op_Explicit",
                                                new[] { new VirtualParameter(valueType, "item") },
                                                returnType: type,
                                                isStatic: true
                                                );

            caseFactory.BodyFactory = () => {
                var @this             = new IL.ILVariable(IL.VariableKind.Parameter, valueType, 0);
                IL.ILInstruction body = new IL.NewObj(caseCtor)
                {
                    Arguments = { new IL.LdLoc(@this) }
                };
                if (valueType.IsReferenceType == true)
                {
                    // pass nulls
                    body = new IL.IfInstruction(
                        new IL.Comp(IL.ComparisonKind.Inequality, Sign.None, new IL.LdLoc(@this), new IL.LdNull()),
                        body,
                        new IL.LdNull()
                        );
                }
                return(EmitExtensions.CreateExpressionFunction(caseFactory, body));
            };
            type.Methods.Add(caseFactory);
            return(caseFactory);
        }
Example #2
0
        public static (VirtualProperty prop, IField field) AddAutoProperty(this VirtualType declaringType, string name, IType propertyType, Accessibility accessibility = Accessibility.Public, bool isReadOnly = true)
        {
            name = E.SymbolNamer.NameMember(declaringType, name, lowerCase: accessibility == Accessibility.Private);


            var field = new VirtualField(declaringType, Accessibility.Private, string.Format(AutoPropertyField, name), propertyType, isReadOnly: isReadOnly, isHidden: true);

            field.Attributes.Add(declaringType.Compilation.CompilerGeneratedAttribute());

            var getter = new VirtualMethod(declaringType, accessibility, string.Format(PropertyGetter, name), Array.Empty <IParameter>(), propertyType, isHidden: true);

            getter.BodyFactory = () => CreateExpressionFunction(getter,
                                                                new IL.LdObj(new IL.LdFlda(new IL.LdLoc(new IL.ILVariable(IL.VariableKind.Parameter, declaringType, -1)), field), propertyType)
                                                                );
            getter.Attributes.Add(declaringType.Compilation.CompilerGeneratedAttribute());
            var setter = isReadOnly ? null :
                         new VirtualMethod(declaringType, accessibility, string.Format(PropertySetter, name), new [] { new VirtualParameter(propertyType, "value") }, declaringType.Compilation.FindType(typeof(void)), isHidden: true);

            var prop = new VirtualProperty(declaringType, accessibility, name, getter, setter);

            declaringType.Methods.Add(getter);
            if (setter != null)
            {
                declaringType.Methods.Add(setter);
            }

            declaringType.Fields.Add(field);
            declaringType.Properties.Add(prop);

            return(prop, field);
        }
Example #3
0
        public static IProperty AddExplicitInterfaceProperty(this VirtualType declaringType, IProperty ifcProperty, IMember baseMember)
        {
            Debug.Assert(declaringType.Equals(baseMember.DeclaringType) || declaringType.GetAllBaseTypeDefinitions().Contains(baseMember.DeclaringType));
            Debug.Assert(ifcProperty.DeclaringType.Kind == TypeKind.Interface);

            var getter = new VirtualMethod(declaringType, Accessibility.Private, "get_" + ifcProperty.FullName, new IParameter[0], ifcProperty.ReturnType, explicitImplementations: new [] { ifcProperty.Getter }, isHidden: true);

            getter.BodyFactory = () => {
                var thisParam = new IL.ILVariable(IL.VariableKind.Parameter, declaringType, -1);
                return(CreateExpressionFunction(getter, new IL.LdLoc(thisParam).AccessMember(baseMember)));
            };
            var setter =
                ifcProperty.Setter == null ? null :
                new VirtualMethod(declaringType, Accessibility.Private, "get_" + ifcProperty.FullName, ifcProperty.Setter.Parameters, ifcProperty.Setter.ReturnType, explicitImplementations: new [] { ifcProperty.Setter }, isHidden: true);

            if (setter != null)
            {
                setter.BodyFactory = () => {
                    var thisParam  = new IL.ILVariable(IL.VariableKind.Parameter, declaringType, -1);
                    var valueParam = new IL.ILVariable(IL.VariableKind.Parameter, declaringType, 0);
                    return(CreateExpressionFunction(getter, new IL.LdLoc(thisParam).AssignMember(baseMember, new IL.LdLoc(valueParam))));
                }
            }
            ;

            var prop = new VirtualProperty(declaringType, Accessibility.Private, ifcProperty.FullName, getter, setter, explicitImplementations: new [] { ifcProperty });

            getter.ApplyAction(declaringType.Methods.Add);
            setter?.ApplyAction(declaringType.Methods.Add);
            prop.ApplyAction(declaringType.Properties.Add);

            return(prop);
        }
 public AnalyzerData analyzedVirtualMethod(VirtualMethod virtualMethod)
 {
     return new AnalyzerData(
     usedTypes, analyzedMethods,
     virtualMethodsToAnalyze.Remove(virtualMethod), analyzedVirtualMethods.Add(virtualMethod)
       );
 }
Example #5
0
        public void Not_supported_features()
        {
            IMethod testing = new VirtualMethod(parentType);

            Assert.AreEqual(0, testing.GetCustomAttributes().Length);
            Assert.AreEqual(0, testing.GetReturnTypeCustomAttributes().Length);
        }
Example #6
0
        public void Declaring_type_is_always_the_given_parent_type()
        {
            IMethod testing = new VirtualMethod(parentType);

            Assert.AreSame(parentType, testing.GetDeclaringType(false));
            Assert.AreSame(parentType, testing.GetDeclaringType(true));
        }
Example #7
0
        public void When_return_type_is_virtual__virtual_type_is_used_for_result_validation()
        {
            var vt = BuildRoutine.VirtualType().FromBasic()
                     .Name.Set("VirtualType")
                     .Namespace.Set("Virtual")
                     .ToStringMethod.Set(o => o.Id)
            ;

            IMethod testing = new VirtualMethod(type.of <string>())
                              .Name.Set("VirtualMethod")
                              .ReturnType.Set(vt)
                              .Body.Set((target, _) =>
            {
                if (Equals(target, "test"))
                {
                    return(new VirtualObject((string)target, vt));
                }

                return(target);
            })
            ;

            var actual = testing.PerformOn("test");

            Assert.AreEqual(new VirtualObject("test", vt), actual);
            Assert.Throws <InvalidCastException>(() => testing.PerformOn("dummy"));
        }
        public static Option <ExpandedMethod> GetMethod(
            ExpandedType type, VirtualMethod virtualMethod
            )
        {
            var virtMethRef = virtualMethod.method.definition;

            foreach (var method in type.methods)
            {
                var methodDefinition = method.definition;
                if (
                    (
                        methodDefinition.Name == virtMethRef.Name
                        // Find explicit implementations as well.
                        || degenerifyMethodName(methodDefinition.Name) == $"{virtMethRef.DeclaringType.FullName}.{virtMethRef.Name}"
                    ) &&
                    methodDefinition.HasGenericParameters == virtMethRef.HasGenericParameters &&
                    (
                        !methodDefinition.HasGenericParameters ||
                        methodDefinition.GenericParameters.Count == virtMethRef.GenericParameters.Count
                    ) && (
//            AreSame(methodDefinition.ReturnType, virtMethRef.ReturnType)
                        method.returnType == virtualMethod.method.returnType &&
                        methodDefinition.HasParameters == virtMethRef.HasParameters
                        ) && (
                        !methodDefinition.HasParameters && !virtMethRef.HasParameters ||
                        method.parameters.SequenceEqual(virtualMethod.method.parameters)
                        )
                    )
                {
                    return(F.some(method));
                }
            }
            return(F.none <ExpandedMethod>());
        }
        public static IMethod ImplementForwardingCaseFactory(this VirtualType type, string caseName, IMethod caseCtor, IMethod valueTypeCtor)
        {
            var valueType = caseCtor.Parameters.Single().Type;

            Debug.Assert(valueType == valueTypeCtor.DeclaringType);

            var caseFactory = new VirtualMethod(type, Accessibility.Public,
                                                E.SymbolNamer.NameMethod(type, caseName, 0, valueTypeCtor.Parameters, isOverride: false),
                                                valueTypeCtor.Parameters,
                                                returnType: type,
                                                isStatic: true,
                                                doccomment: (valueTypeCtor as IWithDoccomment)?.Doccomment
                                                );

            caseFactory.BodyFactory = () => {
                var call = new IL.NewObj(valueTypeCtor);
                call.Arguments.AddRange(valueTypeCtor.Parameters.Select((p, i) => new IL.LdLoc(new IL.ILVariable(IL.VariableKind.Parameter, p.Type, i))));
                return(EmitExtensions.CreateExpressionFunction(caseFactory,
                                                               new IL.NewObj(caseCtor)
                {
                    Arguments = { call }
                }
                                                               ));
            };
            type.Methods.Add(caseFactory);
            return(caseFactory);
        }
Example #10
0
        public void When_return_type_is_value_type__null_result_causes_NullReferenceException()
        {
            IMethod testing = new VirtualMethod(type.of <string>())
                              .Name.Set("virtual")
                              .ReturnType.Set(type.of <int>())
                              .Body.Set((_, _) => null)
            ;

            Assert.Throws <NullReferenceException>(() => testing.PerformOn("test"));
        }
Example #11
0
        public void Before_performing__validates_target_object_against_given_parent_type()
        {
            IMethod testing = new VirtualMethod(type.of <string>())
                              .Name.Set("virtual")
                              .ReturnType.Set(type.of <string>())
                              .Body.Set((target, _) => $"virtual -> {target}")
            ;

            Assert.Throws <InvalidCastException>(() => testing.PerformOn(3));
        }
Example #12
0
        public void Before_returning_result_validates_returning_object_against_given_return_type()
        {
            IMethod testing = new VirtualMethod(type.of <string>())
                              .Name.Set("virtual")
                              .ReturnType.Set(type.of <string>())
                              .Body.Set((_, _) => 3)
            ;

            Assert.Throws <InvalidCastException>(() => testing.PerformOn("dummy"));
        }
Example #13
0
        public void When_target_is_null__NullReferenceException_is_thrown()
        {
            IMethod testing = new VirtualMethod(type.of <string>())
                              .Name.Set("virtual")
                              .ReturnType.Set(type.of <string>())
                              .Body.Set((target, _) => $"virtual -> {target}")
            ;

            Assert.Throws <NullReferenceException>(() => testing.PerformOn(null));
        }
Example #14
0
        public void When_performing_method__invokes_given_delegate()
        {
            IMethod testing = new VirtualMethod(type.of <string>())
                              .ReturnType.Set(type.of <string>())
                              .Body.Set((target, _) => $"virtual -> {target}")
            ;

            var actual = testing.PerformOn("test");

            Assert.AreEqual("virtual -> test", actual);
        }
Example #15
0
        public void Name_is_required()
        {
            IMethod testing = new VirtualMethod(parentType)
                              .Name.Set("virtual")
            ;

            Assert.AreEqual("virtual", testing.Name);

            testing = new VirtualMethod(parentType);

            Assert.Throws <ConfigurationException>(() => { var dummy = testing.Name; });
        }
Example #16
0
        public void When_result_is_null__result_validation_is_skipped()
        {
            IMethod testing = new VirtualMethod(type.of <string>())
                              .Name.Set("virtual")
                              .ReturnType.Set(type.of <string>())
                              .Body.Set((_, _) => null)
            ;

            var actual = testing.PerformOn("test");

            Assert.IsNull(actual);
        }
Example #17
0
        public void Return_type_is_required()
        {
            var typeMock = new Mock <IType>();

            IMethod testing = new VirtualMethod(parentType)
                              .ReturnType.Set(typeMock.Object)
            ;

            Assert.AreSame(typeMock.Object, testing.ReturnType);

            testing = new VirtualMethod(parentType);

            Assert.Throws <ConfigurationException>(() => { var dummy = testing.ReturnType; });
        }
Example #18
0
        public void Null_arguments_skips_validation()
        {
            IMethod testing = new VirtualMethod(type.of <string>())
                              .Name.Set("Concat")
                              .Parameters.Add(p => p.Virtual()
                                              .Name.Set("param1")
                                              .Index.Set(0)
                                              .ParameterType.Set(type.of <string>())
                                              )
                              .ReturnType.Set(type.of <string>())
                              .Body.Set((_, _) => "success")
            ;

            Assert.AreEqual("success", testing.PerformOn("test", new object[] { null }));
        }
Example #19
0
        public void When_a_parameter_type_is_value_type__null_causes_NullReferenceException()
        {
            IMethod testing = new VirtualMethod(type.of <string>())
                              .Name.Set("Concat")
                              .Parameters.Add(p => p.Virtual()
                                              .Name.Set("param1")
                                              .Index.Set(0)
                                              .ParameterType.Set(type.of <int>())
                                              )
                              .ReturnType.Set(type.of <string>())
                              .Body.Set((_, _) => "success")
            ;

            Assert.Throws <NullReferenceException>(() => testing.PerformOn("test", new object[] { null }));
        }
Example #20
0
        public void Target_validation_supports_inheritance()
        {
            IMethod testing = new VirtualMethod(type.of <object>())
                              .Name.Set("virtual")
                              .ReturnType.Set(type.of <string>())
                              .Body.Set((target, _) => $"virtual -> {target}")
            ;

            var actual = testing.PerformOn("test");

            Assert.AreEqual("virtual -> test", actual);

            actual = testing.PerformOn(3);

            Assert.AreEqual("virtual -> 3", actual);
        }
Example #21
0
        public void Arguments_types_are_validated_against_parameter_types()
        {
            IMethod testing = new VirtualMethod(type.of <string>())
                              .Name.Set("Concat")
                              .Parameters.Add(p => p.Virtual()
                                              .Name.Set("param1")
                                              .Index.Set(0)
                                              .ParameterType.Set(type.of <string>())
                                              )
                              .ReturnType.Set(type.of <string>())
                              .Body.Set((_, _) => "success")
            ;

            Assert.Throws <InvalidCastException>(() => testing.PerformOn("test", 1));
            Assert.AreEqual("success", testing.PerformOn("test", "arg1"));
        }
Example #22
0
        public void Parameter_validation_supports_inheritance()
        {
            IMethod testing = new VirtualMethod(type.of <string>())
                              .Name.Set("Concat")
                              .Parameters.Add(p => p.Virtual()
                                              .Name.Set("param1")
                                              .Index.Set(0)
                                              .ParameterType.Set(type.of <object>())
                                              )
                              .ReturnType.Set(type.of <string>())
                              .Body.Set((_, _) => "success")
            ;

            Assert.AreEqual("success", testing.PerformOn("test", "arg1"));
            Assert.AreEqual("success", testing.PerformOn("test", 1));
        }
Example #23
0
        public void Strategy_for_getting_type_of_an_object_can_be_altered_so_that_when_coding_style_is_configured_for_a_custom_type_getting_strategy__it_can_be_applied_to_virtual_methods()
        {
            parentTypeMock.Setup(o => o.CanBe(parentType)).Returns(true);

            IMethod testing = new VirtualMethod(parentType)
                              .Name.Set("VirtualMethod")
                              .Parameters.Add(p => p.Virtual()
                                              .Name.Set("param1")
                                              .Index.Set(0)
                                              .ParameterType.Set(parentType)
                                              )
                              .ReturnType.Set(parentType)
                              .Body.Set((target, parameters) => $"virtual -> {target} {parameters[0]}")
                              .TypeRetrieveStrategy.Set(_ => parentType)
            ;

            var actual = testing.PerformOn("target", "arg1");

            Assert.AreEqual("virtual -> target arg1", actual);
        }
Example #24
0
        public void When_return_type_is_void__null_result_is_expected()
        {
            IMethod testing = new VirtualMethod(type.of <string>())
                              .Name.Set("virtual")
                              .ReturnType.Set(type.ofvoid())
                              .Body.Set((target, _) =>
            {
                if (Equals(target, "null"))
                {
                    return(null);
                }

                return(target);
            })
            ;

            var actual = testing.PerformOn("null");

            Assert.IsNull(actual);
            Assert.Throws <InvalidCastException>(() => testing.PerformOn("not null"));
        }
Example #25
0
        public void Argument_count_cannot_be_less_or_more_than_parameter_count()
        {
            IMethod testing = new VirtualMethod(type.of <string>())
                              .Name.Set("Concat")
                              .Parameters.Add(p => p.Virtual()
                                              .Name.Set("param1")
                                              .Index.Set(0)
                                              .ParameterType.Set(type.of <string>())
                                              )
                              .Parameters.Add(p => p.Virtual()
                                              .Name.Set("param2")
                                              .Index.Set(1)
                                              .ParameterType.Set(type.of <int>())
                                              )
                              .ReturnType.Set(type.of <string>())
                              .Body.Set((_, _) => "success")
            ;

            Assert.Throws <InvalidOperationException>(() => testing.PerformOn("test", "less"));
            Assert.Throws <InvalidOperationException>(() => testing.PerformOn("test", "arg1", 1, "more"));
        }
        public static IMethod ImplementBasicCaseFactory(this VirtualType type, string caseName, IMethod caseCtor)
        {
            var valueType   = caseCtor.Parameters.Single().Type;
            var doccomment  = (valueType.GetDefinition() as IWithDoccomment)?.Doccomment;
            var caseFactory = new VirtualMethod(type, Accessibility.Public,
                                                E.SymbolNamer.NameMethod(type, caseName, 0, new [] { valueType }, isOverride: false),
                                                new[] { new VirtualParameter(valueType, "item") },
                                                returnType: type,
                                                isStatic: true,
                                                doccomment: doccomment
                                                );

            caseFactory.BodyFactory = () =>
                                      EmitExtensions.CreateExpressionFunction(caseFactory,
                                                                              new IL.NewObj(caseCtor)
            {
                Arguments = { new IL.LdLoc(new IL.ILVariable(IL.VariableKind.Parameter, valueType, 0)) }
            }
                                                                              );
            type.Methods.Add(caseFactory);
            return(caseFactory);
        }
Example #27
0
        public void Virtual_parameters_can_be_added()
        {
            IMethod testing = new VirtualMethod(type.of <string>())
                              .Name.Set("Concat")
                              .Parameters.Add(p => p.Virtual()
                                              .Name.Set("param1")
                                              .Index.Set(0)
                                              .ParameterType.Set(type.of <string>())
                                              )
                              .Parameters.Add(p => p.Virtual()
                                              .Name.Set("param2")
                                              .Index.Set(1)
                                              .ParameterType.Set(type.of <int>())
                                              )
                              .Parameters.Add(p => p.Virtual()
                                              .Name.Set("param3")
                                              .Index.Set(2)
                                              .ParameterType.Set(type.of <int[]>())
                                              )
                              .ReturnType.Set(type.of <string>())
                              .Body.Set((target, parameters) =>
                                        $"{target}: {parameters[0]} {(int)parameters[1]} {((int[])parameters[2]).ToItemString()}")
            ;

            Assert.AreEqual(3, testing.Parameters.Count);
            Assert.AreEqual("param1", testing.Parameters[0].Name);
            Assert.AreEqual(0, testing.Parameters[0].Index);
            Assert.AreEqual(type.of <string>(), testing.Parameters[0].ParameterType);
            Assert.AreEqual("param2", testing.Parameters[1].Name);
            Assert.AreEqual(1, testing.Parameters[1].Index);
            Assert.AreEqual(type.of <int>(), testing.Parameters[1].ParameterType);
            Assert.AreEqual("param3", testing.Parameters[2].Name);
            Assert.AreEqual(2, testing.Parameters[2].Index);
            Assert.AreEqual(type.of <int[]>(), testing.Parameters[2].ParameterType);

            var actual = testing.PerformOn("test", "arg1", 1, new[] { 2, 3 });

            Assert.AreEqual("test: arg1 1 [2,3]", actual);
        }
Example #28
0
        public void Result_validation_supports_inheritance()
        {
            IMethod testing = new VirtualMethod(type.of <string>())
                              .Name.Set("virtual")
                              .ReturnType.Set(type.of <object>())
                              .Body.Set((target, _) =>
            {
                if (Equals(target, "1"))
                {
                    return(1);
                }

                return(target);
            })
            ;

            var actual = testing.PerformOn("1");

            Assert.AreEqual(1, actual);

            actual = testing.PerformOn("test");

            Assert.AreEqual("test", actual);
        }
 public static Option<ExpandedMethod> GetMethod(
     ExpandedType type, VirtualMethod virtualMethod
     )
 {
     var virtMethRef = virtualMethod.method.definition;
       foreach (var method in type.methods) {
     var methodDefinition = method.definition;
     if (
       (
     methodDefinition.Name == virtMethRef.Name
     // Find explicit implementations as well.
     || degenerifyMethodName(methodDefinition.Name) == $"{virtMethRef.DeclaringType.FullName}.{virtMethRef.Name}"
       ) &&
       methodDefinition.HasGenericParameters == virtMethRef.HasGenericParameters &&
       (
     !methodDefinition.HasGenericParameters
     || methodDefinition.GenericParameters.Count == virtMethRef.GenericParameters.Count
       ) && (
     //            AreSame(methodDefinition.ReturnType, virtMethRef.ReturnType)
     method.returnType == virtualMethod.method.returnType
     && methodDefinition.HasParameters == virtMethRef.HasParameters
       ) && (
     !methodDefinition.HasParameters && !virtMethRef.HasParameters
     || method.parameters.SequenceEqual(virtualMethod.method.parameters)
       )
     ) return F.some(method);
       }
       return F.none<ExpandedMethod>();
 }
 public AnalyzerData addVirtualMethod(VirtualMethod method)
 {
     return virtualMethodsToAnalyze.Contains(method) || analyzedVirtualMethods.Contains(method)
     ? this : new AnalyzerData(usedTypes, analyzedMethods, virtualMethodsToAnalyze.Add(method), analyzedVirtualMethods);
 }
        private ResponseMethodDTO ExecuteRedirectView(MethodInfo methodToExecute, object[] parameters, IViewHandler viewHandler, MethodInfo methodToResponse)
        {
            ResponseMethodDTO responseMethodDTO = (ResponseMethodDTO) FactoryDTO.Instance.Create (CreateDTO.ResponseMethod);
            try {
                object ret = methodToExecute.Invoke (this, parameters);
                responseMethodDTO.MethodResult = ret;
                responseMethodDTO.SetExecutionSuccess (true);
                if (VirtualMethod != null) {
                    VirtualMethod (responseMethodDTO);
                    VirtualMethod = null;
                }
                //Beta Implementation
                //
                if (!ViewHandlerCollection.Contains (viewHandler)) {
                    ViewHandlerCollection.Add (viewHandler);
                    logger.Debug ("A new view has been added to View Cache");
                }
                else {
                    logger.Debug ("This view has already been registered at View Cache.");
                }
                //
                //End

                methodToResponse.Invoke (viewHandler, new object[] {responseMethodDTO});
            }
            catch (TargetInvocationException exception) {
                this.MapException (exception);
            }
            return responseMethodDTO;
        }
 private ResponseMethodDTO ExecuteRedirectNewView(MethodInfo methodToExecute, object[] parameters, Type viewType, MethodInfo methodToResponse)
 {
     ResponseMethodDTO responseMethodDTO = (ResponseMethodDTO) FactoryDTO.Instance.Create (CreateDTO.ResponseMethod);
     try {
         object ret = methodToExecute.Invoke (this, parameters);
         responseMethodDTO.MethodResult = ret;
         object obj = viewType.GetConstructor (null).Invoke (null);
         responseMethodDTO.SetExecutionSuccess (true);
         if (VirtualMethod != null) {
             VirtualMethod (responseMethodDTO);
             VirtualMethod = null;
         }
         methodToResponse.Invoke (obj, new object[] {responseMethodDTO});
         //Beta Implementation
         //
         //Siempre se va a a�adir esta vista puesto que es una vista
         //nueva.
         ViewHandlerCollection.Add ((IViewHandler)obj);
         logger.Debug ("A new view has been added to View Cache.");
         //
         //End
         return responseMethodDTO;
     }
     catch (TargetInvocationException exception) {
         this.MapException (exception);
     }
     return responseMethodDTO;
 }
 private ResponseMethodDTO ExecuteNoRedirect(MethodInfo methodToExecute, object[] parameters)
 {
     ResponseMethodDTO responseMethodDTO = (ResponseMethodDTO) FactoryDTO.Instance.Create (CreateDTO.ResponseMethod);
     try {
         object ret = methodToExecute.Invoke (this, parameters);
         responseMethodDTO.MethodResult = ret;
         responseMethodDTO.SetExecutionSuccess (true);
         if (VirtualMethod != null) {
             VirtualMethod (responseMethodDTO);
             VirtualMethod = null;
         }
     }
     catch (TargetInvocationException exception) {
         this.MapException (exception);
     }
     return responseMethodDTO;
 }
Example #34
0
        public void Parent_type_is_what_is_given_as_parent_type()
        {
            IMethod testing = new VirtualMethod(parentType);

            Assert.AreSame(parentType, testing.ParentType);
        }
Example #35
0
        public void Virtual_methods_are_public()
        {
            IMethod testing = new VirtualMethod(parentType);

            Assert.IsTrue(testing.IsPublic);
        }