2 // RelaxngValidatingReaderTests.cs
5 // Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
7 // (C) 2003 Atsushi Enomoto
13 using Commons
.Xml
.Relaxng
;
14 using NUnit
.Framework
;
16 using RVR
= Commons
.Xml
.Relaxng
.RelaxngValidatingReader
;
17 using MonoTests
.Helpers
;
19 namespace MonoTests
.Commons
.Xml
.Relaxng
22 public class RelaxngValidatingReaderTests
24 RelaxngValidatingReader reader
;
31 private void SetupReaderFromUrl (string instanceUrl
, string grammarUrl
)
33 reader
= new RelaxngValidatingReader (
34 new XmlTextReader (instanceUrl
),
35 new XmlTextReader (grammarUrl
));
38 private void SetupReader (string instance
, string grammar
)
40 reader
= new RelaxngValidatingReader (
41 new XmlTextReader (new StringReader (instance
)),
42 new XmlTextReader (new StringReader (grammar
)));
47 public void SimpleElementPattern1 ()
49 SetupReaderFromUrl (TestResourceHelper
.GetFullPathOfResource ("Test/XmlFiles/SimpleElementPattern1.xml"),
50 TestResourceHelper
.GetFullPathOfResource ("Test/XmlFiles/SimpleElementPattern1.rng"));
57 public void SimpleElementPattern2 ()
59 SetupReaderFromUrl (TestResourceHelper
.GetFullPathOfResource ("Test/XmlFiles/SimpleElementPattern2.xml"),
60 TestResourceHelper
.GetFullPathOfResource ("Test/XmlFiles/SimpleElementPattern2.rng"));
67 public void ReadPracticalSample1 ()
69 SetupReaderFromUrl (TestResourceHelper
.GetFullPathOfResource ("Test/XmlFiles/team.xml"), TestResourceHelper
.GetFullPathOfResource ("Test/XmlFiles/team.rng"));
75 public void ValidateRelaxngGrammar ()
77 // validate relaxng.rng with relaxng.rng
79 new XmlTextReader (TestResourceHelper
.GetFullPathOfResource ("Test/XmlFiles/relaxng.rng")),
80 new XmlTextReader (TestResourceHelper
.GetFullPathOfResource ("Test/XmlFiles/relaxng.rng")));