Mercurial > repos > IBBoard.Tests
annotate Xml/XmlResourceResolverTests.cs @ 46:179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
* Add test for resolver using standard URIs
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 31 Aug 2012 20:39:29 +0100 |
parents | |
children | 66eee91f51b3 |
rev | line source |
---|---|
46
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 // This file (XmlResourceResolverTests.cs) is a part of the IBBoard.Tests project and is copyright 2012 IBBoard |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 // |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU LGPL, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 using System; |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 using NUnit.Framework; |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 using System.Reflection; |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 using System.IO; |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 using NUnit.Framework.SyntaxHelpers; |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 namespace IBBoard.Xml |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 { |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 [TestFixture()] |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 public class XmlResourceResolverTests |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 { |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 [Test()] |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 public void TestGettingStreamForAddedResource() |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
17 { |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 Assembly localAssembly = Assembly.GetExecutingAssembly(); |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
19 XmlResourceResolver resolver = new XmlResourceResolver(localAssembly); |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
20 string uriString = "http://ibboard.co.uk/some.xsd"; |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
21 string resourceID = "IBBoard.test-data.ResourceResolver.some.xsd"; |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
22 resolver.AddMapping(uriString, resourceID); |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
23 Stream resolvedStream = (Stream)resolver.GetEntity(new Uri(uriString), null, typeof(Stream)); |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
24 Assert.That(resolvedStream, Is.EqualTo(localAssembly.GetManifestResourceStream(resourceID))); |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
25 } |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
26 } |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
27 } |
179c4cf6aecf
Re #49: XmlResourceResolver fails with HTML DTD on Windows
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
28 |