Beispiel #1
0
        public Asset_CreateCacheManifest_Tests()
        {
            root = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()));
            root.CreateSubdirectory("module");
            filename = Path.Combine(root.FullName, "module", "test.js");
            // Write some testable content to the file.
            File.WriteAllText(filename, "asset content");
            var fileSystem = new FileSystemDirectory(root.FullName);

            var module = new Module("~/module");
            asset = new Asset("~/module/test.js", module, fileSystem.GetFile("module\\test.js"));
            module.Assets.Add(asset);

            File.WriteAllText(Path.Combine(root.FullName, "module", "another.js"), "");
            var another = new Asset("~/module/another.js", module, fileSystem.GetFile("module\\another.js"));
            module.Assets.Add(another);
        }
Beispiel #2
0
        public void AddReferenceToSiblingFilenameInSubDirectory_ExpandsFilenameToAbsolutePath()
        {
            root.CreateSubdirectory("module\\sub");
            File.WriteAllText(Path.Combine(root.FullName, "module", "sub", "another.js"), "");
            var another = new Asset("~/module/sub/another.js", module, StubFile());
            module.Assets.Add(another);

            asset.AddReference("sub\\another.js", 1);

            asset.References.First().Path.ShouldEqual("~/module/sub/another.js");
        }
Beispiel #3
0
 public void ConstructorNormalizesPath()
 {
     root.CreateSubdirectory("module\\test");
     File.WriteAllText(Path.Combine(root.FullName, "module", "test", "bar.js"), "");
     var asset = new Asset("~\\module\\test\\bar.js", module, StubFile());
     asset.SourceFilename.ShouldEqual("~/module/test/bar.js");
 }
Beispiel #4
0
        public Asset_Tests()
        {
            root = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()));
            root.CreateSubdirectory("module");

            module = new Module("~/module");
            asset = new Asset("~/module/test.js", module, StubFile("asset content"));
            module.Assets.Add(asset);

            var another = new Asset("~/module/another.js", module, StubFile());
            module.Assets.Add(another);
        }