Ejemplo n.º 1
0
        public void PythonScript_OnElement_works()
        {
            string               text     = @"
from SharpETL.Components import Element
def OnElement(a, e):
  yield Element(e.Id, e.Id, [])";
            string               testeid  = "TestOK_OnElement";
            PythonScript         script   = new PythonScript("script", text, _pythonEngine);
            Mock <IScriptAction> maction  = new Mock <IScriptAction>();
            Mock <IElement>      melement = new Mock <IElement>();

            melement.Setup(x => x.Id).Returns(testeid);
            var result = script.OnElement(maction.Object, melement.Object);

            foreach (IElement e in result)
            {
                Assert.AreEqual(testeid, e.Name);
                Assert.AreEqual(testeid, e.Id);
            }
        }