編輯:我第一次嘗試回答沒有奏效。這個呢。
我只有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());