当前位置: 首页>>代码示例>>C#>>正文


C# ScriptManager.Add方法代码示例

本文整理汇总了C#中ScriptManager.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptManager.Add方法的具体用法?C# ScriptManager.Add怎么用?C# ScriptManager.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ScriptManager的用法示例。


在下文中一共展示了ScriptManager.Add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddTest_1

 public void AddTest_1()
 {
     string temp;
     ScriptManager sm = new ScriptManager();
     bool result = sm.Add("text", true, out temp);
     Assert.IsNotNull(temp);
     Assert.IsFalse(result);
 }
开发者ID:Richterr,项目名称:Simple-Script-Environment,代码行数:8,代码来源:ScriptManagerTests.cs

示例2: AddTest_3

 public void AddTest_3()
 {
     string temp;
     ScriptManager sm = new ScriptManager();
     bool result = sm.Add(_incorrectCode, true, out temp);
     Assert.AreNotEqual(temp, "");
     Assert.IsFalse(result);
 }
开发者ID:Richterr,项目名称:Simple-Script-Environment,代码行数:8,代码来源:ScriptManagerTests.cs

示例3: ScriptManager_Add_Null_Throws_Exception_Test

        public void ScriptManager_Add_Null_Throws_Exception_Test()
        {
            var cacheManager = new Mock<ICacheManager>();
            var contextAccessor = new Mock<IHttpContextAccessor>();
            var target = new ScriptManager(cacheManager.Object, contextAccessor.Object);

            ScriptInfo info = null;
            target.Add(info);
        }
开发者ID:philpeace,项目名称:CodePeace.StrawberryJam,代码行数:9,代码来源:ScriptManagerTests.cs

示例4: AddTest_4

 public void AddTest_4()
 {
     string temp;
     ScriptManager sm = new ScriptManager();
     File.WriteAllText("AddTest_4.cs", _correctCode);
     bool result = sm.Add("AddTest_4.cs", true, out temp);
     File.Delete("AddTest_4.cs");
     Assert.AreEqual(temp, "");
     Assert.IsTrue(result);
 }
开发者ID:Richterr,项目名称:Simple-Script-Environment,代码行数:10,代码来源:ScriptManagerTests.cs

示例5: AddScriptSource

        public static MvcHtmlString AddScriptSource(this HtmlHelper helper, Func<dynamic, HelperResult> source, string key, string area = null)
        {
            var scriptType = ScriptType.JavaScript;

            var info = new ScriptInfo(source(null).ToHtmlString(), scriptType, key, area);

            var manager = new ScriptManager();

            manager.Add(info);

            return MvcHtmlString.Empty;
        }
开发者ID:philpeace,项目名称:CodePeace.StrawberryJam,代码行数:12,代码来源:ScriptManagerHelper.cs

示例6: AddJavaScript

        public static MvcHtmlString AddJavaScript(this HtmlHelper helper, string localPath, string area = null)
        {
            var scriptType = ScriptType.JavaScript;

            var info = new ScriptInfo(localPath, helper.ViewContext.HttpContext.Server.MapPath(localPath).Replace(@"/", @"\"), scriptType,  area);

            var manager = new ScriptManager();

            manager.Add(info);

            return MvcHtmlString.Empty;
        }
开发者ID:philpeace,项目名称:CodePeace.StrawberryJam,代码行数:12,代码来源:ScriptManagerHelper.cs

示例7: ScriptManager_Add_External_StyleSheet_ScriptInfo_Test

        public void ScriptManager_Add_External_StyleSheet_ScriptInfo_Test()
        {
            var cacheManager = new Mock<ICacheManager>();
            var contextAccessor = new Mock<IHttpContextAccessor>();
            var list = new Mock<IScriptFileList>();

            var context = new Mock<HttpContextBase>
            {
                DefaultValue = DefaultValue.Mock
            };

            contextAccessor.Setup(c => c.Current()).Returns(context.Object);
            context.SetupGet(c => c.Application["__sm__Stylesheet"]).Returns(() => list.Object);

            var target = new ScriptManager(cacheManager.Object, contextAccessor.Object);

            IScriptInfo info = new ScriptInfo(null, "SomeLocalPath", ScriptType.Stylesheet);

            target.Add(info);

            list.Verify(l => l.Add(info), Times.Once());
        }
开发者ID:philpeace,项目名称:CodePeace.StrawberryJam,代码行数:22,代码来源:ScriptManagerTests.cs

示例8: ExecuteTest

 public void ExecuteTest()
 {
     string temp;
     ScriptManager sm = new ScriptManager();
     File.WriteAllText("RemoveTest_2.cs", _correctCode);
     bool result = sm.Add("RemoveTest_2.cs", true, out temp);
     File.Delete("RemoveTest_2.cs");
     try
     {
         sm.Execute();
     }
     catch (Exception ex)
     {
         Assert.Fail("Expected no exception, but got: " + ex.Message);
     }
 }
开发者ID:Richterr,项目名称:Simple-Script-Environment,代码行数:16,代码来源:ScriptManagerTests.cs

示例9: RemoveTest_2

 public void RemoveTest_2()
 {
     string temp;
     ScriptManager sm = new ScriptManager();
     File.WriteAllText("RemoveTest_2.cs", _correctCode);
     bool result = sm.Add("RemoveTest_2.cs", true, out temp);
     result = sm.Remove("RemoveTest_2.cs");
     Assert.IsTrue(result);
     File.Delete("RemoveTest_2.cs");
 }
开发者ID:Richterr,项目名称:Simple-Script-Environment,代码行数:10,代码来源:ScriptManagerTests.cs


注:本文中的ScriptManager.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。