AspectSharp.Lang.Tests.ParserPointcutTestCase.DoParsing C# (CSharp) Метод

DoParsing() защищенный Метод

protected DoParsing ( string method, string access, string type, string name, string param1 ) : void
method string
access string
type string
name string
param1 string
Результат void
		protected void DoParsing(string method, string access, string type, string name, string param1)
		{
			string allparams;
			if (param1 != null)
				allparams = "(" + param1 + ")";
			else
				allparams = string.Empty;					
				
			AspectParser parser = CreateParser(string.Format(
				"aspect XPTO for MyNamespace.MyType \n\n" +
				" pointcut {0}({1} {2} {3}{4}) \n" +
				"   advice(My.NS.Interceptor in My.Assembly ) \n" +
				" end \n" +
				"end", method, access, type, name, allparams));
			string s = string.Format("{0}({1} {2} {3}{4})", method, access, type, name, allparams);
			EngineConfiguration conf = parser.Parse();
			AspectDefinition def = conf.Aspects[0];
			PointCutDefinition pc = def.PointCuts[0];
			if (name == "*")
				name = ".*";
			Assert.AreEqual(string.Format("({0} {1} {2}({3}))", access == "" ? "*" : access, type, name, param1 == null ? "" : param1), pc.Method.ToString());
			Assert.AreEqual(method == "method", ((pc.Flags & PointCutFlags.Method) != 0), "method check: " + s);
			Assert.AreEqual(access == "*" || access == "", pc.Method.AllAccess, "AllAccess: " + s);
			Assert.AreEqual(type == "*", pc.Method.AllRetTypes, "AllRetTypes: " + s);
			Assert.AreEqual(name, pc.Method.MethodName, "MethodName: " + s);
			Assert.AreEqual(access == "" ? "*" : access, pc.Method.Access, "Access: " + s);
			Assert.AreEqual(type, pc.Method.RetType, "RetType: " + s);
			if (param1 == null || param1.Length == 0)
				Assert.AreEqual(0, pc.Method.Arguments.Length, "No Params: " + s);
			else {
				Assert.AreEqual(1, pc.Method.Arguments.Length, "1 Param: " + s);
				Assert.AreEqual(param1, pc.Method.Arguments[0], "Param: " + s);
			}
		}