本文整理汇总了C#中System.ServiceModel.Description.WsdlImporter.ImportBinding方法的典型用法代码示例。如果您正苦于以下问题:C# WsdlImporter.ImportBinding方法的具体用法?C# WsdlImporter.ImportBinding怎么用?C# WsdlImporter.ImportBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ServiceModel.Description.WsdlImporter
的用法示例。
在下文中一共展示了WsdlImporter.ImportBinding方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BasicHttpBinding_ImportBinding
public void BasicHttpBinding_ImportBinding ()
{
var label = new TestLabel ("BasicHttpBinding_ImportBinding");
var doc = TestContext.LoadMetadata ("BasicHttp");
var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
var wsdlBinding = sd.Bindings [0];
var importer = new WsdlImporter (doc);
Assert.That (sd.Bindings, Is.Not.Null, label.Get ());
Assert.That (sd.Bindings.Count, Is.EqualTo (1), label.Get ());
var binding = importer.ImportBinding (wsdlBinding);
BindingTestAssertions.CheckImportErrors (importer, label);
Assert.That (binding, Is.Not.Null, label.Get ());
}
示例2: BasicHttpBinding_Error
public void BasicHttpBinding_Error ()
{
var label = new TestLabel ("BasicHttpBinding_Error");
var doc = TestContext.LoadMetadata ("http-error.xml");
var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
var wsdlBinding = sd.Bindings [0];
var importer = new WsdlImporter (doc);
label.EnterScope ("all");
var bindings = importer.ImportAllBindings ();
Assert.That (bindings, Is.Not.Null, label.Get ());
Assert.That (bindings.Count, Is.EqualTo (0), label.Get ());
label.EnterScope ("errors");
Assert.That (importer.Errors, Is.Not.Null, label.Get ());
Assert.That (importer.Errors.Count, Is.EqualTo (1), label.Get ());
var error = importer.Errors [0];
Assert.That (error.IsWarning, Is.False, label.Get ());
label.LeaveScope ();
label.LeaveScope ();
label.EnterScope ("single");
try {
importer.ImportBinding (wsdlBinding);
Assert.Fail (label.Get ());
} catch {
;
}
Assert.That (importer.Errors.Count, Is.EqualTo (1), label.Get ());
label.LeaveScope ();
label.EnterScope ("single-first");
var importer2 = new WsdlImporter (doc);
try {
importer2.ImportBinding (wsdlBinding);
Assert.Fail (label.Get ());
} catch {
;
}
Assert.That (importer2.Errors.Count, Is.EqualTo (1), label.Get ());
try {
importer2.ImportBinding (wsdlBinding);
Assert.Fail (label.Get ());
} catch {
;
}
var bindings2 = importer.ImportAllBindings ();
Assert.That (bindings2, Is.Not.Null, label.Get ());
Assert.That (bindings2.Count, Is.EqualTo (0), label.Get ());
label.LeaveScope ();
}