Time to write some test cases.
[Test]
def chapter_save():
title = "Alice's Adventures In Wonderland"
target = detab("""
<chapter title="${title}" />
""")
chapter = Chapter()
chapter.title = title
sw = StringWriter()
xs = xws()
using r = XmlWriter.Create(sw, xs):
chapter.save(r)
Assert.AreEqual(target, "${sw}\n")
[Test]
def chapter_save2():
title = "Alice's Adventures In Wonderland"
target = detab("""
<chapter title="${title}" />
""")
chapter = Chapter(title)
sw = StringWriter()
xs = xws()
using r = XmlWriter.Create(sw, xs):
chapter.save(r)
Assert.AreEqual(target, "${sw}\n")
[Test]
def chapter_load():
title = "Alice's Adventures In Wonderland"
source = detab("""
<chapter title="${title}" />
""")
ch = Chapter();
sr = StringReader(source)
r = XmlReader.Create(sr)
r.MoveToContent()
ch.load(r)
assert ch.title == title
No comments:
Post a Comment