public virtual void RetrieveStyleSheetByMalformedResourceNameTest() { NUnit.Framework.Assert.That(() => { String fileName = "retrieveStyl eSheetTest.css"; ResourceResolver resourceResolver = new ResourceResolver(baseUri); resourceResolver.RetrieveStyleSheet(fileName); } , NUnit.Framework.Throws.InstanceOf <IOException>()); }
public virtual void malformedResourceNameTest1() { NUnit.Framework.Assert.That(() => { String fileName = "retrieveStyl eSheetTest.css"; ResourceResolver resourceResolver = new ResourceResolver(baseUri); resourceResolver.RetrieveStyleSheet(fileName); } , NUnit.Framework.Throws.TypeOf <FileNotFoundException>()); ; }
public virtual void RetrieveStyleSheetTest() { String fileName = "retrieveStyleSheetTest.css"; Stream expected = new FileStream(baseUri + fileName, FileMode.Open, FileAccess.Read); ResourceResolver resourceResolver = new ResourceResolver(baseUri); Stream stream = resourceResolver.RetrieveStyleSheet(fileName); Assert.NotNull(stream); Assert.AreEqual(expected.Read(), stream.Read()); }
public virtual void MalformedResourceNameTest07() { String fileName = "%23%5B%5D@!$&'()+,;=._~-/styles09.css"; Stream expected = new FileStream(baseUri + "#[]@!$&'()+,;=._~-/styles09.css", FileMode.Open, FileAccess.Read); ResourceResolver resourceResolver = new ResourceResolver(baseUri); Stream stream = resourceResolver.RetrieveStyleSheet(fileName); Assert.NotNull(stream); Assert.AreEqual(expected.Read(), stream.Read()); }
public virtual void absolutePathTest() { //TODO check this test with on linux or mac with mono! String fileName = "retrieveStyleSheetTest.css"; String absolutePath = UrlUtil.ToNormalizedURI(baseUri).AbsolutePath + fileName; Stream expected = new FileStream(absolutePath, FileMode.Open, FileAccess.Read); ResourceResolver resourceResolver = new ResourceResolver(baseUri); Stream stream = resourceResolver.RetrieveStyleSheet(absolutePath); NUnit.Framework.Assert.NotNull(stream); NUnit.Framework.Assert.AreEqual(expected.Read(), stream.Read()); }
public virtual void RetrieveStyleSheetAbsolutePathTest() { String fileName = "retrieveStyleSheetTest.css"; String absolutePath = Path.Combine(baseUri, fileName).ToFile().FullName; ResourceResolver resourceResolver = new ResourceResolver(baseUri); using (Stream stream = resourceResolver.RetrieveStyleSheet(absolutePath), expected = new FileStream(absolutePath, FileMode.Open, FileAccess.Read)) { Assert.NotNull(stream); Assert.AreEqual(expected.Read(), stream.Read()); } }
public virtual void RetrieveStyleSheetFileUrlTest() { String fileName = "retrieveStyleSheetTest.css"; Uri url = Path.Combine(baseUri, fileName).ToUri().ToUrl(); String fileUrlString = url.ToExternalForm(); ResourceResolver resourceResolver = new ResourceResolver(baseUri); using (Stream stream = resourceResolver.RetrieveStyleSheet(fileUrlString), expected = UrlUtil.OpenStream(url)) { Assert.NotNull(stream); Assert.AreEqual(expected.Read(), stream.Read()); } }