2014-08-13 10:39:27 +01:00
|
|
|
//
|
|
|
|
// NvdlValidatingReaderTests.cs
|
|
|
|
//
|
|
|
|
// Authors:
|
|
|
|
// Atsushi Enomoto <atsushi@ximian.com>
|
|
|
|
//
|
|
|
|
// Copyright (C) 2006 Novell Inc.
|
|
|
|
//
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
using System.Xml;
|
|
|
|
using Commons.Xml.Nvdl;
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
2019-02-04 20:11:37 +00:00
|
|
|
using MonoTests.Helpers;
|
|
|
|
|
2015-01-13 10:44:36 +00:00
|
|
|
namespace MonoTests.Commons.Xml.Relaxng
|
2014-08-13 10:39:27 +01:00
|
|
|
{
|
|
|
|
[TestFixture]
|
|
|
|
public class NvdlValidatingReaderTests
|
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void ReadNvdlNvdl ()
|
|
|
|
{
|
2019-02-04 20:11:37 +00:00
|
|
|
using (TextReader r = File.OpenText (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/nvdl.nvdl"))) {
|
2014-08-13 10:39:27 +01:00
|
|
|
NvdlRules rules = NvdlReader.Read (
|
|
|
|
new XmlTextReader (r));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void ValidateNvdlNvdl ()
|
|
|
|
{
|
|
|
|
NvdlRules rules = null;
|
2019-02-04 20:11:37 +00:00
|
|
|
string path = TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/nvdl.nvdl");
|
2014-08-13 10:39:27 +01:00
|
|
|
using (TextReader r = File.OpenText (path)) {
|
|
|
|
rules = NvdlReader.Read (
|
|
|
|
new XmlTextReader (path, r));
|
|
|
|
}
|
|
|
|
using (TextReader r = File.OpenText (path)) {
|
|
|
|
XmlTextReader xtr = new XmlTextReader (path, r);
|
|
|
|
NvdlValidatingReader vr = new NvdlValidatingReader (xtr, rules);
|
|
|
|
while (!vr.EOF)
|
|
|
|
vr.Read ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|