编辑:我第一次尝试回答没有奏效。这个呢。
我只有VS 2010在我的BizTalk虚拟机上,所以这是与痣,但它应该与我希望的假货一样工作。它直接执行xslt转换,并用绕道(shimmed)覆盖扩展对象集合。这里的Moled程序集是“C:\ Program Files(x86)\ Microsoft BizTalk Server 2010 \ Developer Tools \ Microsoft.BizTalk.BaseFunctoids.dll”。
var inputStream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream("TestProject.TestFile.xml");
XPathDocument xpath = new XPathDocument(inputStream);
var myFunctoids = new Microsoft.BizTalk.BaseFunctoids.Moles.MFunctoidScripts();
myFunctoids.DBLookupInt32StringStringStringString = (a, b, c, d, e) => "1";
myFunctoids.DBValueExtractInt32String = (a, b) => "result";
myFunctoids.DBLookupShutdown =() => "";
XsltArgumentList extensionObjects = new XsltArgumentList();
extensionObjects.AddExtensionObject("http://schemas.microsoft.com/BizTalk/2003/ScriptNS0",
myFunctoids.Instance);
var outputStream = new MemoryStream();
var myMap = (Microsoft.XLANGs.BaseTypes.TransformBase)new Map1();
myMap.Transform.Transform(xpath, extensionObjects, outputStream);
outputStream.Position = 0;
Assert.AreEqual("<expected>result</expected>", new StreamReader(outputStream).ReadToEnd());