Files
mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/MessageFaultTest.cs
T
Atsushi Eno a22727c329 2009-05-15 Atsushi Enomoto <[email protected]>
* MessageFault.cs : Reason is mandatory. raise XmlException, and
	  CommunicationException in each CreateFault().

	* soap-fault-incomplete.xml : new test file.
	* MessageFaultTest.cs : new test.

	* System.ServiceModel.dll_test.sources: added MessageFaultTest.cs.


svn path=/trunk/mcs/; revision=134197
2009-05-15 11:27:39 +00:00

39 lines
1.0 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]
[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"));
}
}
}