Пример #1
0
        public static List <string> AdjustHtmlForMoveAssets(DataInfo info,
                                                            Options options)
        {
            List <string> stringsResult = new List <string>();

            if (options.IsUseMoveAssets() == true)
            {
                foreach (string s in info.HtmlStrings)
                {
                    string str = s;
                    string strReplace;
                    Asset  theAsset = info.GetAssetFromString(s);
                    if (theAsset != null)
                    {
                        if (theAsset.IsScriptAsset() == false)
                        {
                            strReplace = @"assets\img\" + theAsset.RawAsset;
                            str        = s.Replace(theAsset.HtmlAsset, strReplace);
                            stringsResult.Add(str);
                        }
                    }
                    else
                    {
                        stringsResult.Add(str);
                    }
                }
            }

            return(stringsResult);
        }
        public void GetAssetFromString_FailureTest()
        {
            string   str   = "test asset";
            DataInfo info  = CreateDataInfoWithAssets();
            Asset    asset = info.GetAssetFromString(str);

            Assert.IsNull(asset);
        }
        public void GetAssetFromString_NormalTest2()
        {
            DataInfo info  = CreateDataInfoWithAssets();
            Asset    asset = info.GetAssetFromString(_asset2);

            Assert.IsNotNull(asset);
            Assert.AreEqual(_asset2, asset.HtmlAsset);
        }