Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -105,23 +105,53 @@ namespace MonoTests.System.ServiceModel.Dispatcher
Assert.AreEqual (5, p.ErrorCode, "#2");
Assert.AreEqual ("foobarerror", p.Text, "#3");
}
} finally {
host.Close ();
}
}
[Test]
public void FaultContractInfos_2 ()
{
var host = new ServiceHost (typeof (TestFaultContract));
int port = NetworkHelpers.FindFreePort ();
host.Description.Behaviors.Find<ServiceDebugBehavior> ().IncludeExceptionDetailInFaults = false;
host.AddServiceEndpoint (typeof (ITestFaultContract), new BasicHttpBinding (), new Uri ("http://localhost:" + port));
host.Open ();
try {
var cf = new ChannelFactory<ITestFaultContract> (new BasicHttpBinding (), new EndpointAddress ("http://localhost:" + port));
var cli = cf.CreateChannel ();
try {
cli.Run ("deriveddata");
Assert.Fail ("#4");
} catch (Exception ex) {
} catch (FaultException ex) {
// The type must be explicitly listed in the [FaultContract],
// it is not allowed to use a subclass of the exception data type.
Assert.AreEqual (typeof (FaultException), ex.GetType (), "#5");
}
} finally {
host.Close ();
}
}
[Test]
public void FaultContractInfos_3 ()
{
var host = new ServiceHost (typeof (TestFaultContract));
int port = NetworkHelpers.FindFreePort ();
host.Description.Behaviors.Find<ServiceDebugBehavior> ().IncludeExceptionDetailInFaults = false;
host.AddServiceEndpoint (typeof (ITestFaultContract), new BasicHttpBinding (), new Uri ("http://localhost:" + port));
host.Open ();
try {
var cf = new ChannelFactory<ITestFaultContract> (new BasicHttpBinding (), new EndpointAddress ("http://localhost:" + port));
var cli = cf.CreateChannel ();
try {
cli.Run ("derivedexception");
Assert.Fail ("#6");
} catch (Exception ex) {
} catch (FaultException<PrivateAffairError> ex) {
// However, it is allowed to derive from FaultException<T>, provided
// that T is explicitly listed in [FaultContract]. Bug #7177.
Assert.AreEqual (typeof (FaultException<PrivateAffairError>), ex.GetType (), "#7");
}
} finally {
host.Close ();