Пример #1
0
 [Test] public void GenericMethodWithParmsIsInvoked() {
     var member = new MemberName("genericmethodofsystemint32", "genericmethod", new[] { typeof(int)});
     var method = MemberQuery.FindInstance(MemberQuery.FindMember, instance,
             new MemberSpecification(member, 1));
     Assert.IsNotNull(method);
     var result = method.Invoke(new object[] {123});
     Assert.AreEqual("sample123", result.Value.ToString());
 }
Пример #2
0
 void ExecuteOptionalMethod(MemberName theMethodName, Parse theCell) {
     try {
         Processor.Invoke(this, theMethodName, theCell); //todo: invokewiththrow?
     }
     catch (Exception e) { 
         TestStatus.MarkException(theCell, e);
     }
 }
Пример #3
0
        public TypedValue InvokeSpecial(TypedValue instance, MemberName memberName, Tree<Cell> parameters) {
            var type = Processor.ApplicationUnderTest.FindType("fit.Parse").Type;

    		// lookup Fixture
			foreach (var member in FindMember(instance, memberName, type).Value)
			{
                return member.Invoke(new object[] { parameters.Value });
            }

			// lookup FlowKeywords
			var runtimeType = Processor.ApplicationUnderTest.FindType("fit.Fixtures.FlowKeywords");
			var runtimeMember = runtimeType.GetConstructor(2);
			var flowKeywords = runtimeMember.Invoke(new[] { instance.Value, Processor });

			foreach (var member in FindMember(flowKeywords, memberName, type).Value)
			{
				return member.Invoke(new object[] { parameters.Value });
			}
			
			return TypedValue.MakeInvalid(new MemberMissingException(instance.Type, memberName.Name, 1));
        }
Пример #4
0
 public TypedValue InvokeSpecial(TypedValue instance, MemberName memberName, Tree<Cell> parameters)
 {
     return keywords[memberName.Name](instance.GetValue<FlowInterpreter>(), parameters);
 }
Пример #5
0
 public bool CanInvokeSpecial(TypedValue instance, MemberName memberName, Tree<Cell> parameters)
 {
     return keywords.ContainsKey(memberName.Name);
 }
Пример #6
0
 static Maybe<RuntimeMember> FindMember(TypedValue flowKeywords, MemberName memberName, Type type) {
     return MemberQuery.FindDirectInstance(flowKeywords.Value,
             new MemberSpecification(memberName).WithParameterTypes(new[] {type}));
 }
Пример #7
0
 public bool CanInvokeSpecial(TypedValue instance, MemberName memberName, Tree<Cell> parameters) {
     return true;
 }
Пример #8
0
 public Maybe<RuntimeMember> FindStatic(MemberName memberName, Type[] parameterTypes) {
     return new MemberQuery(
             new MemberSpecification(memberName, parameterTypes.Length).WithParameterTypes(parameterTypes))
         .StaticOnly()
         .FindMember(Type);
 }
Пример #9
0
 public TypedValue InvokeSpecial(TypedValue instance, MemberName memberName, Tree<Cell> parameters)
 {
     return TypedValue.MakeInvalid(new MemberMissingException(instance.Type, memberName.Name, 1));
 }
Пример #10
0
 public MemberSpecification(MemberName memberName)
 {
     parameterCount = 0;
     this.memberName = memberName;
 }
Пример #11
0
 public MemberSpecification(string memberName, int parameterCount)
 {
     this.parameterCount = parameterCount;
     this.memberName = new MemberName(memberName);
 }
Пример #12
0
 public MemberSpecification(MemberName memberName, int parameterCount)
 {
     this.parameterCount = parameterCount;
     this.memberName = memberName;
 }
Пример #13
0
 public TypedValue InvokeSpecial(TypedValue instance, MemberName memberName, Tree<Cell> parameters)
 {
     if (memberName.Name != "akeyword") return TypedValue.MakeInvalid(new ApplicationException("argh"));
     Field = "somevalue";
     return TypedValue.Void;
 }