Пример #1
0
        public AssetSerializer_Tests()
        {
            asset = new Mock<IAsset>();
            asset.SetupGet(a => a.Path).Returns("~/asset");
            asset.SetupGet(a => a.AssetCacheValidatorType).Returns(typeof(Caching.FileAssetCacheValidator));
            asset.SetupGet(a => a.References).Returns(new[]
            {
                new AssetReference("~/asset", "~/bundle", 1, AssetReferenceType.DifferentBundle),
                new AssetReference("~/asset", "~/image.png", 2, AssetReferenceType.RawFilename),
                new AssetReference("~/asset", "http://example.com/", 3, AssetReferenceType.Url)
            });

            containerElement = new XElement("Bundle");
            var serializer = new AssetSerializer(containerElement);
            serializer.Serialize(asset.Object);
            assetElement = containerElement.Elements("Asset").FirstOrDefault();
        }
Пример #2
0
        public AssetSerializer_Tests()
        {
            asset = new Mock <IAsset>();
            asset.SetupGet(a => a.Path).Returns("~/asset");
            asset.SetupGet(a => a.AssetCacheValidatorType).Returns(typeof(Caching.FileAssetCacheValidator));
            asset.SetupGet(a => a.References).Returns(new[]
            {
                new AssetReference("~/asset", "~/bundle", 1, AssetReferenceType.DifferentBundle),
                new AssetReference("~/asset", "~/image.png", 2, AssetReferenceType.RawFilename),
                new AssetReference("~/asset", "http://example.com/", 3, AssetReferenceType.Url)
            });

            containerElement = new XElement("Bundle");
            var serializer = new AssetSerializer(containerElement);

            serializer.Serialize(asset.Object);
            assetElement = containerElement.Elements("Asset").FirstOrDefault();
        }
Пример #3
0
        void WriteAssetElements(XElement bundleElement)
        {
            var assetSerializer = new AssetSerializer(bundleElement);

            bundle.Accept(assetSerializer);
        }