public void GenerateGlobalMixinsAndInterceptors() { AspectParser parser = CreateParser( "import XPTO " + "import XY in My.Assembly " + " " + " interceptors [ \"key\" : MyType in MyAssembly; \"key2\" : MyTypeThatMustBeResolved ] " + " mixins [ \"key\" : MyType in MyAssembly; \"key2\" : MyTypeThatMustBeResolved ] " + " " + " " + " "); EngineConfiguration conf = parser.Parse(); XmlTreeVisitor visitor = new XmlTreeVisitor(); visitor.Visit( conf ); String content = visitor.Document.InnerXml; Assert.AreEqual( "<configuration>" + "<import namespace=\"XPTO\" />" + "<import namespace=\"XY\" assembly=\"My.Assembly\" />" + "<mixins><mixin key=\"key\" type=\"MyType\" refTypeEnum=\"Type\" assembly=\"MyAssembly\" />" + "<mixin key=\"key2\" type=\"MyTypeThatMustBeResolved\" refTypeEnum=\"Type\" />" + "</mixins><interceptors>" + "<interceptor key=\"key\" type=\"MyType\" refTypeEnum=\"Type\" assembly=\"MyAssembly\" />" + "<interceptor key=\"key2\" type=\"MyTypeThatMustBeResolved\" refTypeEnum=\"Type\" />" + "</interceptors></configuration>", content ); }
public void GenerateImports() { AspectParser parser = CreateParser( "import XPTO " + "import XY in My.Assembly "); EngineConfiguration conf = parser.Parse(); XmlTreeVisitor visitor = new XmlTreeVisitor(); visitor.Visit( conf ); String content = visitor.Document.InnerXml; Assert.AreEqual( "<configuration>" + "<import namespace=\"XPTO\" />" + "<import namespace=\"XY\" assembly=\"My.Assembly\" />" + "</configuration>", content ); }
public void GenerateAspectWithIncludes() { AspectParser parser = CreateParser( "import XPTO " + "import XY in My.Assembly " + " " + " aspect McBrother for MyType in MyAssembly " + " include \"key\"" + " include MyType in MyAssembly" + " end" + " "); EngineConfiguration conf = parser.Parse(); XmlTreeVisitor visitor = new XmlTreeVisitor(); visitor.Visit( conf ); String content = visitor.Document.InnerXml; Assert.AreEqual( "<configuration>" + "<import namespace=\"XPTO\" />" + "<import namespace=\"XY\" assembly=\"My.Assembly\" />" + "<aspect name=\"McBrother\"><for>" + "<singletype type=\"MyType\" refTypeEnum=\"Type\" assembly=\"MyAssembly\" />" + "</for>" + "<mixin type=\"key\" refTypeEnum=\"Link\" />" + "<mixin type=\"MyType\" refTypeEnum=\"Type\" assembly=\"MyAssembly\" />" + "</aspect></configuration>", content ); }
public void GenerateAspectWithPointcuts() { AspectParser parser = CreateParser( "import XPTO " + "import XY in My.Assembly " + " " + " aspect McBrother for MyType in MyAssembly " + " " + " pointcut method(*)" + " advice(MyType)" + " end" + " " + " end" + " "); EngineConfiguration conf = parser.Parse(); XmlTreeVisitor visitor = new XmlTreeVisitor(); visitor.Visit( conf ); String content = visitor.Document.InnerXml; Assert.AreEqual( "<configuration>" + "<import namespace=\"XPTO\" />" + "<import namespace=\"XY\" assembly=\"My.Assembly\" />" + "<aspect name=\"McBrother\">" + "<for><singletype type=\"MyType\" refTypeEnum=\"Type\" assembly=\"MyAssembly\" />" + "</for>" + "<pointcut symbol=\"Method\"><signature>(*)</signature>" + "<interceptor type=\"MyType\" refTypeEnum=\"Type\" />" + "</pointcut></aspect></configuration>", content ); }