Skip to content

Commit

Permalink
2003-01-18 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
Browse files Browse the repository at this point in the history
	* added XmlWriterTests.cs file and added it to AllTests.cs

svn path=/trunk/mcs/; revision=10655
  • Loading branch information
atsushieno committed Jan 18, 2003
1 parent 2d7a230 commit a5d23fa
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 0 deletions.
1 change: 1 addition & 0 deletions mcs/class/System.XML/Test/AllTests.cs
Expand Up @@ -22,6 +22,7 @@ public class AllTests : TestCase
suite.AddTest (new TestSuite (typeof (XmlProcessingInstructionTests)));
suite.AddTest (new TestSuite (typeof (XmlTextTests)));
suite.AddTest (new TestSuite (typeof (XmlTextReaderTests)));
suite.AddTest (new TestSuite (typeof (XmlWriterTests)));
suite.AddTest (new TestSuite (typeof (XmlTextWriterTests)));
suite.AddTest (new TestSuite (typeof (XmlNamespaceManagerTests)));
suite.AddTest (new TestSuite (typeof (XmlAttributeTests)));
Expand Down
4 changes: 4 additions & 0 deletions mcs/class/System.XML/Test/ChangeLog
@@ -1,3 +1,7 @@
2003-01-18 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>

* added XmlWriterTests.cs file and added it to AllTests.cs

2003-01-13 Nick Drochak <ndrochak@gol.com>

* XmlNodeTests.cs: MS.NET doesn't throw an exception here.
Expand Down
206 changes: 206 additions & 0 deletions mcs/class/System.XML/Test/XmlWriterTests.cs
@@ -0,0 +1,206 @@
//
// System.Xml.XmlTextWriterTests
//
// Author:
// Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
//
// (C) 2003 Atsushi Enomoto
//
//
// This class mainly checks inheritance and behaviors of XmlWriter.
//



using System;
using System.IO;
using System.Text;
using System.Xml;

using NUnit.Framework;

namespace MonoTests.System.Xml
{
public class XmlWriterTests : TestCase
{
public XmlWriterTests () : base ("MonoTests.System.Xml.XmlWriterTests testsuite") {}
public XmlWriterTests (string name) : base (name) {}

protected override void SetUp ()
{
}

// MS.NET's not-overriden XmlWriter.WriteStartElement(name)
// invokes WriteStartElement(null, name, null).
// WriteStartElement(name, ns) invokes (null, name, ns), too.
public void TestStartElement ()
{
StartElementTestWriter xw = new StartElementTestWriter ();
xw.WriteStartDocument ();
xw.WriteStartElement ("test");
AssertEquals ("StartElementOverride.NS", null, xw.NS);
AssertEquals ("StartElementOverride.Prefix", null, xw.Prefix);
xw.NS = String.Empty;
xw.Prefix = String.Empty;
xw.WriteStartElement ("test", "urn:hoge");
AssertEquals ("StartElementOverride.NS", "urn:hoge", xw.NS);
AssertEquals ("StartElementOverride.Prefix", null, xw.Prefix);
}

class StartElementTestWriter : DefaultXmlWriter
{
public StartElementTestWriter () : base () {}
public string NS = String.Empty;
public string Prefix = String.Empty;

public override void WriteStartElement (string prefix, string localName, string ns)
{
this.NS = ns;
this.Prefix = prefix;
}
}
}

internal class DefaultXmlWriter : XmlWriter
{
public DefaultXmlWriter () : base ()
{
}

public override void Close ()
{
}

public override void Flush ()
{
}

public override string LookupPrefix (string ns)
{
return null;
}

public override void WriteBase64 (byte [] buffer, int index, int count)
{
}

public override void WriteBinHex (byte [] buffer, int index, int count)
{
}

public override void WriteCData (string text)
{
}

public override void WriteCharEntity (char ch)
{
}

public override void WriteChars (char [] buffer, int index, int count)
{
}

public override void WriteComment (string text)
{
}

public override void WriteDocType (string name, string pubid, string sysid, string subset)
{
}

public override void WriteEndAttribute ()
{
}

public override void WriteEndDocument ()
{
}

public override void WriteEndElement ()
{
}

public override void WriteEntityRef (string name)
{
}

public override void WriteFullEndElement ()
{
}

public override void WriteName (string name)
{
}

public override void WriteNmToken (string name)
{
}

public override void WriteNode (XmlReader reader, bool defattr)
{
}

public override void WriteProcessingInstruction (string name, string text)
{
}

public override void WriteQualifiedName (string localName, string ns)
{
}

public override void WriteRaw (string data)
{
}

public override void WriteRaw (char [] buffer, int index, int count)
{
}

public override void WriteStartAttribute (string prefix, string localName, string ns)
{
}

public override void WriteStartDocument (bool standalone)
{
}

public override void WriteStartDocument ()
{
}

public override void WriteStartElement (string prefix, string localName, string ns)
{
}

public override void WriteString (string text)
{
}

public override void WriteSurrogateCharEntity (char lowChar, char highChar)
{
}

public override void WriteWhitespace (string ws)
{
}

public override WriteState WriteState {
get {
return WriteState.Start;
}
}

public override string XmlLang {
get {
return null;
}
}

public override XmlSpace XmlSpace {
get {
return XmlSpace.None;
}
}

}
}

0 comments on commit a5d23fa

Please sign in to comment.