Exemplo n.º 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());
 }
Exemplo n.º 2
0
 void ExecuteOptionalMethod(MemberName theMethodName, Parse theCell) {
     try {
         Processor.Invoke(this, theMethodName, theCell); //todo: invokewiththrow?
     }
     catch (Exception e) { 
         TestStatus.MarkException(theCell, e);
     }
 }
Exemplo n.º 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));
        }
Exemplo n.º 4
0
 public TypedValue InvokeSpecial(TypedValue instance, MemberName memberName, Tree<Cell> parameters)
 {
     return keywords[memberName.Name](instance.GetValue<FlowInterpreter>(), parameters);
 }
Exemplo n.º 5
0
 public bool CanInvokeSpecial(TypedValue instance, MemberName memberName, Tree<Cell> parameters)
 {
     return keywords.ContainsKey(memberName.Name);
 }
Exemplo n.º 6
0
 static Maybe<RuntimeMember> FindMember(TypedValue flowKeywords, MemberName memberName, Type type) {
     return MemberQuery.FindDirectInstance(flowKeywords.Value,
             new MemberSpecification(memberName).WithParameterTypes(new[] {type}));
 }
Exemplo n.º 7
0
 public bool CanInvokeSpecial(TypedValue instance, MemberName memberName, Tree<Cell> parameters) {
     return true;
 }
Exemplo n.º 8
0
 public Maybe<RuntimeMember> FindStatic(MemberName memberName, Type[] parameterTypes) {
     return new MemberQuery(
             new MemberSpecification(memberName, parameterTypes.Length).WithParameterTypes(parameterTypes))
         .StaticOnly()
         .FindMember(Type);
 }
Exemplo n.º 9
0
 public TypedValue InvokeSpecial(TypedValue instance, MemberName memberName, Tree<Cell> parameters)
 {
     return TypedValue.MakeInvalid(new MemberMissingException(instance.Type, memberName.Name, 1));
 }
Exemplo n.º 10
0
 public MemberSpecification(MemberName memberName)
 {
     parameterCount = 0;
     this.memberName = memberName;
 }
Exemplo n.º 11
0
 public MemberSpecification(string memberName, int parameterCount)
 {
     this.parameterCount = parameterCount;
     this.memberName = new MemberName(memberName);
 }
Exemplo n.º 12
0
 public MemberSpecification(MemberName memberName, int parameterCount)
 {
     this.parameterCount = parameterCount;
     this.memberName = memberName;
 }
Exemplo n.º 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;
 }