Files
mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/MessageFaultTest.cs
T
Atsushi Eno 31009113d4 2009-05-19 Atsushi Enomoto <[email protected]>
* MessageFault.cs : fix several SOAP12 fault deserialization in xml
	  parsing.

	* MessageFaultTest.cs : added more SOAP 12 fault parser tests.
	* soap-fault.xml, soap-fault-incomplete4.xml : new test files.


svn path=/trunk/mcs/; revision=134389
2009-05-19 12:01:20 +00:00

54 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Text;
using System.Xml;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel.Channels
{
[TestFixture]
public class MessageFaultTest
{
[Test]
public void CreateFault ()
{
var msg = Message.CreateMessage (XmlReader.Create (new StreamReader ("Test/System.ServiceModel.Channels/soap-fault.xml")), 0x10000, MessageVersion.Default);
MessageFault.CreateFault (msg, 0x10000);
}
[Test]
[ExpectedException (typeof (CommunicationException))]
public void CreateFaultIncomplete ()
{
var msg = Message.CreateMessage (XmlReader.Create (new StreamReader ("Test/System.ServiceModel.Channels/soap-fault-incomplete.xml")), 0x10000, MessageVersion.Default);
MessageFault.CreateFault (msg, 0x10000);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void CreateFaultIncomplete2 ()
{
MessageFault.CreateFault (new FaultCode ("s:Sender"), (FaultReason) null);
}
[Test]
// [ExpectedException (typeof (CommunicationException))]
public void CreateFaultIncomplete3 ()
{
MessageFault.CreateFault (new FaultCode ("s:Sender"), new FaultReason ("anyways"));
}
[Test]
[ExpectedException (typeof (CommunicationException))]
public void CreateFaultIncomplete4 ()
{
var msg = Message.CreateMessage (XmlReader.Create (new StreamReader ("Test/System.ServiceModel.Channels/soap-fault-incomplete4.xml")), 0x10000, MessageVersion.Default);
MessageFault.CreateFault (msg, 0x10000);
}
}
}