Exemple #1
0
        public void CanResolveResource()
        {
            var resourcePath = "http://example.com";

            var httpResolver = new HttpResolver();

            var path = httpResolver.Resolve(resourcePath);

            Assert.AreEqual(_htmlContent, File.ReadAllText(path));

            TempFileResolutionCache.Clear();

            Assert.False(File.Exists(path));
        }
        public void CanResolveResource_Root()
        {
            var resourcePath = "SquishIt.Tests://RootEmbedded.css";

            var embeddedResourceResolver = new RootEmbeddedResourceResolver();

            var path = embeddedResourceResolver.Resolve(resourcePath);

            Assert.AreEqual(cssContent, File.ReadAllText(path));

            TempFileResolutionCache.Clear();

            Assert.False(File.Exists(path));
        }
        public void CanResolveResource_Standard()
        {
            var resourcePath = "SquishIt.Tests://EmbeddedResource.Embedded.css";

            var embeddedResourceResolver = new StandardEmbeddedResourceResolver();

            var path = embeddedResourceResolver.Resolve(resourcePath);

            Assert.True(path.EndsWith("EmbeddedResource.Embedded.css"));

            Assert.AreEqual(cssContent, File.ReadAllText(path));

            TempFileResolutionCache.Clear();

            Assert.False(File.Exists(path));
        }
Exemple #4
0
        public void CanResolveResource_Reuses_Previous_Temp_File()
        {
            var resourcePath = "http://example.com";

            var embeddedResourceResolver = new HttpResolver();

            var path  = embeddedResourceResolver.Resolve(resourcePath);
            var path2 = embeddedResourceResolver.Resolve(resourcePath);

            Assert.AreEqual(_htmlContent, File.ReadAllText(path));
            Assert.AreEqual(_htmlContent, File.ReadAllText(path2));

            Assert.AreEqual(path, path2);

            TempFileResolutionCache.Clear();

            Assert.False(File.Exists(path));
        }
        public void CanResolveResource_Standard_Reuses_Previous_Temp_File()
        {
            var resourcePath = "SquishIt.Tests://EmbeddedResource.Embedded.css";

            var embeddedResourceResolver = new StandardEmbeddedResourceResolver();

            var path  = embeddedResourceResolver.Resolve(resourcePath);
            var path2 = embeddedResourceResolver.Resolve(resourcePath);

            Assert.AreEqual(cssContent, File.ReadAllText(path));
            Assert.AreEqual(cssContent, File.ReadAllText(path2));

            Assert.AreEqual(path, path2);

            TempFileResolutionCache.Clear();

            Assert.False(File.Exists(path));
        }
Exemple #6
0
 public static void Shutdown()
 {
     TempFileResolutionCache.Clear();
 }