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


C# ScriptManager.Generate方法代码示例

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


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

示例1: ScriptManager_Generate_Sets_Correct_ContentType_For_JavaScript

        public void ScriptManager_Generate_Sets_Correct_ContentType_For_JavaScript()
        {
            var cacheManager = new Mock<ICacheManager>();
            var contextAccessor = new Mock<IHttpContextAccessor>();
            var info = new Mock<IScriptGenerationInfo>();
            info.SetupGet(i => i.Type).Returns(ScriptType.JavaScript);
            var list = new Mock<IScriptFileList>();
            var items = new Dictionary<string, object>();
            items.Add("__sm__JavaScript", list.Object);

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

            contextAccessor.Setup(c => c.Current()).Returns(context.Object);
            context.SetupGet(c => c.Items).Returns(items);

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

            IScriptOutput actual;
            actual = target.Generate(info.Object);

            var expected = @"application/javascript";

            Assert.AreEqual(expected, actual.ContentType);
        }
开发者ID:philpeace,项目名称:CodePeace.StrawberryJam,代码行数:27,代码来源:ScriptManagerTests.cs

示例2: ScriptManager_Generate_Sets_Correct_ContentType_For_Stylesheet

        public void ScriptManager_Generate_Sets_Correct_ContentType_For_Stylesheet()
        {
            string area = "foo";

            List<IScriptInfo> scripts = new List<IScriptInfo>();

            var cacheManager = new Mock<ICacheManager>();
            var contextAccessor = new Mock<IHttpContextAccessor>();

            var info = new Mock<IScriptGenerationInfo>();
            info.SetupGet(i => i.Type).Returns(ScriptType.Stylesheet);
            info.SetupGet(i => i.Area).Returns(area);

            var list = new Mock<IScriptFileList>();

            list.Setup(l => l.ScriptsForArea(area)).Returns(scripts);

            var items = new Dictionary<string, object>();
            items.Add("__sm__Stylesheet", list.Object);

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

            contextAccessor.Setup(c => c.Current()).Returns(context.Object);
            context.SetupGet(c => c.Items).Returns(items);

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

            IScriptOutput actual;
            actual = target.Generate(info.Object);

            var expected = @"text/css";

            Assert.AreEqual(expected, actual.ContentType);
        }
开发者ID:philpeace,项目名称:CodePeace.StrawberryJam,代码行数:37,代码来源:ScriptManagerTests.cs

示例3: ScriptManager_Generate_With_Null_ScriptInfo_Throws_Exception_Test

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

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

            IScriptGenerationInfo info = null;
            IScriptOutput actual;
            actual = target.Generate(info);
        }
开发者ID:philpeace,项目名称:CodePeace.StrawberryJam,代码行数:11,代码来源:ScriptManagerTests.cs


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