From: <bo...@us...> - 2010-07-20 17:33:44
|
Revision: 417 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=417&view=rev Author: bodewig Date: 2010-07-20 17:33:37 +0000 (Tue, 20 Jul 2010) Log Message: ----------- make directory references more regular for tests - location itself is not the problem on Mono, it seems xsi:schemaLocation is Modified Paths: -------------- trunk/xmlunit/src/main/net-core/input/AbstractSource.cs trunk/xmlunit/src/tests/net-core/TestResources.cs trunk/xmlunit/src/tests/net-core/builder/InputTest.cs trunk/xmlunit/src/tests/net-core/validation/ValidatorTest.cs Modified: trunk/xmlunit/src/main/net-core/input/AbstractSource.cs =================================================================== --- trunk/xmlunit/src/main/net-core/input/AbstractSource.cs 2010-07-15 06:41:10 UTC (rev 416) +++ trunk/xmlunit/src/main/net-core/input/AbstractSource.cs 2010-07-20 17:33:37 UTC (rev 417) @@ -38,5 +38,9 @@ systemId = value; } } + public override string ToString() { + return string.Format("{0} with systemId {1}", GetType().Name, + SystemId); + } } } Modified: trunk/xmlunit/src/tests/net-core/TestResources.cs =================================================================== --- trunk/xmlunit/src/tests/net-core/TestResources.cs 2010-07-15 06:41:10 UTC (rev 416) +++ trunk/xmlunit/src/tests/net-core/TestResources.cs 2010-07-20 17:33:37 UTC (rev 417) @@ -11,18 +11,27 @@ See the License for the specific language governing permissions and limitations under the License. */ + +using System; + namespace net.sf.xmlunit { public sealed class TestResources { - public const string ANIMAL_FILE = "../../../src/tests/resources/test1.xml"; - public const string BLAME_FILE = "../../../src/tests/resources/test.blame.html"; + private static readonly string PREFIX = "../../../"; - public const string ANIMAL_XSL = "../../../src/tests/resources/animal.xsl"; - public const string DOG_FILE = "../../../src/tests/resources/testAnimal.xml"; + public static readonly string TESTS_DIR = + PREFIX + "src/tests/resources/"; - public const string BOOK_DTD = "../../../src/tests/resources/Book.dtd"; - public const string TEST_DTD = "../../../src/tests/resources/test.dtd"; + public static readonly string ANIMAL_FILE = TESTS_DIR + "test1.xml"; + public static readonly string BLAME_FILE = + TESTS_DIR + "test.blame.html"; + public static readonly string ANIMAL_XSL = TESTS_DIR + "animal.xsl"; + public static readonly string DOG_FILE = TESTS_DIR + "testAnimal.xml"; + + public static readonly string BOOK_DTD = TESTS_DIR + "Book.dtd"; + public static readonly string TEST_DTD = TESTS_DIR + "test.dtd"; + private TestResources() { } } } Modified: trunk/xmlunit/src/tests/net-core/builder/InputTest.cs =================================================================== --- trunk/xmlunit/src/tests/net-core/builder/InputTest.cs 2010-07-15 06:41:10 UTC (rev 416) +++ trunk/xmlunit/src/tests/net-core/builder/InputTest.cs 2010-07-20 17:33:37 UTC (rev 417) @@ -88,7 +88,7 @@ [Test] public void ShouldParseATransformationFromSource() { ISource input = Input.FromMemory("<animal>furry</animal>").Build(); ISource s = Input.ByTransforming(input) - .WithStylesheet(Input.FromFile("../../../src/tests/resources/animal.xsl") + .WithStylesheet(Input.FromFile(TestResources.TESTS_DIR + "animal.xsl") .Build()) .Build(); Assert.That(s, Is.Not.Null); @@ -100,7 +100,7 @@ [Test] public void ShouldParseATransformationFromBuilder() { Input.IBuilder input = Input.FromMemory("<animal>furry</animal>"); ISource s = Input.ByTransforming(input) - .WithStylesheet(Input.FromFile("../../../src/tests/resources/animal.xsl")) + .WithStylesheet(Input.FromFile(TestResources.TESTS_DIR + "animal.xsl")) .Build(); Assert.That(s, Is.Not.Null); XmlDocument d = Parse(s); Modified: trunk/xmlunit/src/tests/net-core/validation/ValidatorTest.cs =================================================================== --- trunk/xmlunit/src/tests/net-core/validation/ValidatorTest.cs 2010-07-15 06:41:10 UTC (rev 416) +++ trunk/xmlunit/src/tests/net-core/validation/ValidatorTest.cs 2010-07-20 17:33:37 UTC (rev 417) @@ -23,7 +23,7 @@ [Test] public void ShouldSuccessfullyValidateSchema() { Validator v = Validator.ForLanguage(Languages.W3C_XML_SCHEMA_NS_URI); - v.SchemaSource = new StreamSource("../../../src/tests/resources/Book.xsd"); + v.SchemaSource = new StreamSource(TestResources.TESTS_DIR + "Book.xsd"); ValidationResult r = v.ValidateSchema(); Assert.IsTrue(r.Valid); Assert.IsFalse(r.Problems.GetEnumerator().MoveNext()); @@ -32,8 +32,8 @@ [Test] public void ShouldSuccessfullyValidateInstance() { Validator v = Validator.ForLanguage(Languages.W3C_XML_SCHEMA_NS_URI); - v.SchemaSource = new StreamSource("../../../src/tests/resources/Book.xsd"); - ValidationResult r = v.ValidateInstance(new StreamSource("../../../src/tests/resources/BookXsdGenerated.xml")); + v.SchemaSource = new StreamSource(TestResources.TESTS_DIR + "Book.xsd"); + ValidationResult r = v.ValidateInstance(new StreamSource(TestResources.TESTS_DIR + "BookXsdGenerated.xml")); IEnumerator<ValidationProblem> problems = r.Problems.GetEnumerator(); bool haveErrors = problems.MoveNext(); @@ -47,7 +47,7 @@ [Test] public void ShouldFailOnBrokenSchema() { Validator v = Validator.ForLanguage(Languages.W3C_XML_SCHEMA_NS_URI); - v.SchemaSource = new StreamSource("../../../src/tests/resources/broken.xsd"); + v.SchemaSource = new StreamSource(TestResources.TESTS_DIR + "broken.xsd"); ValidationResult r = v.ValidateSchema(); Assert.IsFalse(r.Valid); Assert.IsTrue(r.Problems.GetEnumerator().MoveNext()); @@ -56,8 +56,8 @@ [Test] public void ShouldFailOnBrokenInstance() { Validator v = Validator.ForLanguage(Languages.W3C_XML_SCHEMA_NS_URI); - v.SchemaSource = new StreamSource("../../../src/tests/resources/Book.xsd"); - ValidationResult r = v.ValidateInstance(new StreamSource("../../../src/tests/resources/invalidBook.xml")); + v.SchemaSource = new StreamSource(TestResources.TESTS_DIR + "Book.xsd"); + ValidationResult r = v.ValidateInstance(new StreamSource(TestResources.TESTS_DIR + "invalidBook.xml")); Assert.IsFalse(r.Valid); Assert.IsTrue(r.Problems.GetEnumerator().MoveNext()); } @@ -65,9 +65,9 @@ [Test] public void ShouldThrowWhenValidatingInstanceAndSchemaIsInvalid() { Validator v = Validator.ForLanguage(Languages.W3C_XML_SCHEMA_NS_URI); - v.SchemaSource = new StreamSource("../../../src/tests/resources/broken.xsd"); + v.SchemaSource = new StreamSource(TestResources.TESTS_DIR + "broken.xsd"); Assert.Throws(typeof(XMLUnitException), delegate() { - v.ValidateInstance(new StreamSource("../../../src/tests/resources/BookXsdGenerated.xml")); + v.ValidateInstance(new StreamSource(TestResources.TESTS_DIR + "BookXsdGenerated.xml")); }); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |