Inheritance: AssetBase, IDisposable
Ejemplo n.º 1
0
 public DiskBackedBundleCache_Tests()
 {
     //The directory should never be called, always just passed into FileHelper which is mocked also, so strict
     //with nothing setup
     directory = new Mock<IDirectory>(MockBehavior.Strict);
     fileHelper = new Mock<IFileHelper>(MockBehavior.Strict);
     fileHelper.Setup(fh => fh.PrepareCachingDirectory(It.IsAny<string>(), It.IsAny<string>()));
     fileHelper.Setup(fh => fh.CreateDirectory(It.IsAny<string>()));
     uncachedToCachedFiles = new Mock<IDictionary<string, string>>(MockBehavior.Strict);
     diskBackedBundleCache = new DiskBackedBundleCache(fileHelper.Object);
     unprocessedAssetPaths = new List<string>();
     fileBundle = new TestableBundle("~/file");
     concatenatedBundle = new TestableBundle("~/concatenated");
     emptyBundle = new TestableBundle("~/empty");
     var stubFileCreation = typeof(Asset_Tests).GetMethod("StubFile", BindingFlags.NonPublic | BindingFlags.Instance);
     fileAsset = new FileAsset((IFile)stubFileCreation.Invoke(new Asset_Tests(), new object[] { "asset content", Type.Missing }), fileBundle);
     fileBundle.Assets.Add(fileAsset);
     var file = (IFile)stubFileCreation.Invoke(new Asset_Tests(), new object[] { "asset content", Type.Missing });
     fileHelper.Setup(fh => fh.GetFileSystemFile(It.IsAny<IDirectory>(), It.IsAny<string>(), It.IsAny<string>()))
         .Returns(file);
     concatenatedAsset = new ConcatenatedAsset(new List<IAsset> {fileAsset} );
     concatenatedBundle.Assets.Add(concatenatedAsset);
     AddToDiskMethodInfo = typeof(DiskBackedBundleCache).GetMethod("AddToDisk", BindingFlags.NonPublic | BindingFlags.Instance);
     GetFromDiskMethodInfo = typeof(DiskBackedBundleCache).GetMethod("GetFromDisk", BindingFlags.NonPublic | BindingFlags.Instance);
 }
Ejemplo n.º 2
0
 public ConcatenatedAssetWithSeparator_Tests()
 {
     var child1 = new Mock<IAsset>();
     var child2 = new Mock<IAsset>();
     child1.Setup(c => c.OpenStream()).Returns(() => new MemoryStream(Encoding.UTF8.GetBytes("first")));
     child2.Setup(c => c.OpenStream()).Returns(() => new MemoryStream(Encoding.UTF8.GetBytes("second")));
     asset = new ConcatenatedAsset(new[] { child1.Object, child2.Object }, ";");
 }
Ejemplo n.º 3
0
 public GivenConcatenatedAsset_WithTwoChildren()
 {
     child1 = new Mock<IAsset>();
     child1.Setup(c => c.OpenStream()).Returns(() => Stream.Null);
     child2 = new Mock<IAsset>();
     child2.Setup(c => c.OpenStream()).Returns(() => Stream.Null);
     asset = new ConcatenatedAsset(
         new[] { child1.Object, child2.Object }
     );
 }
Ejemplo n.º 4
0
        internal void ConcatenateAssets()
        {
            if (assets.Count == 0) return;

            Trace.Source.TraceInformation("Concatenating assets of {0}", path);
            var concatenated = new ConcatenatedAsset(assets);
            assets.Clear();
            assets.Add(concatenated);
            Trace.Source.TraceInformation("Concatenated assets of {0}", path);
        }
Ejemplo n.º 5
0
 public ConcatenatedAsset_Tests()
 {
     var child = new Mock<IAsset>();
     child.Setup(c => c.OpenStream()).Returns(() => new MemoryStream(new byte[] {1, 2, 3}));
     asset = new ConcatenatedAsset(new[] {child.Object});
 }
Ejemplo n.º 6
0
        internal void ConcatenateAssets()
        {
            if (assets.Count == 0) return;

            var concatenated = new ConcatenatedAsset(assets);
            assets.Clear();
            assets.Add(concatenated);
        }