Пример #1
0
 private void ReadParameterToken_Supports(IEnumerable<string> args, Type classType, string methodName, string expectedParameterName, object expectedValue, int valuesRead) {
     MethodInfo method = classType.GetMethod(methodName);
     ParameterInfo expectedParameter = method.GetParameters().Single(p => p.Name == expectedParameterName);
     Assert.IsNotNull(method);
     Queue<string> queue = new Queue<string>(args);
     int initQueueSize = queue.Count;
     ArgParserProxy proxy = new ArgParserProxy(method.DeclaringType);
     ParserContext context = new ParserContext { ActionMethod = method };
     object result = proxy.ReadParameterTokenPublic(queue, context);
     Assert.IsNotNull(result);
     Assert.IsInstanceOf<ParameterValueToken>(result);
     ParameterValueToken token = (ParameterValueToken) result;
     Assert.AreEqual(expectedParameter, token.Parameter);
     Assert.AreEqual(expectedValue, token.Value);
     Assert.AreEqual(initQueueSize - valuesRead, queue.Count);
 }
Пример #2
0
 public void ReadActionMethodToken_Finds_ActionMethod_By_AttributeName() {
     ArgParserProxy proxy = new ArgParserProxy(typeof(Class1));
     ParserContext context = new ParserContext();
     Queue<string> queue = new Queue<string>(new[] { "Bar2" });
     object result = proxy.ReadActionMethodTokenPublic(queue, context);
     Assert.IsNotNull(result);
     Assert.IsInstanceOf<ActionMethodToken>(result);
     ActionMethodToken token = (ActionMethodToken) result;
     Assert.AreEqual(typeof(Class1).GetMethod("Bar1"), token.Method);
 }
Пример #3
0
 public object ReadActionMethodTokenPublic(Queue<string> queue, ParserContext context) {
     return this.ReadActionMethodToken(queue, context);
 }
Пример #4
0
 public void ReadActionMethodToken_Throws_ArgumentException_When_Queue_Is_Empty() {
     ArgParserProxy proxy = new ArgParserProxy(typeof(Class1));
     ParserContext context = new ParserContext();
     Queue<string> queue = new Queue<string>();
     proxy.ReadActionMethodTokenPublic(queue, context);
 }
Пример #5
0
 public object ReadParameterTokenPublic(Queue<string> queue, ParserContext context) {
     return this.ReadParameterToken(queue, context);
 }