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


C# HtmlHelper.EnableQUnitTesting方法代码示例

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


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

示例1: EnableQUnitEmptyIfNotTestMode

        public void EnableQUnitEmptyIfNotTestMode()
        {
            var httpContext = MockRepository.GenerateStub<HttpContextBase>();
            var viewContext = MockRepository.GenerateStub<ViewContext>();

            viewContext.HttpContext = httpContext;
            viewContext.RequestContext = new RequestContext( httpContext, new RouteData() );
            var html = new HtmlHelper( viewContext, new ViewPage() );
            Assert.AreEqual( "", html.EnableQUnitTesting() );
        }
开发者ID:Mitch-Constantine,项目名称:CometGateway,代码行数:10,代码来源:EnableQUnitTest.cs

示例2: EnableQUnitIfTestMode

        public void EnableQUnitIfTestMode()
        {
            var httpContext = MockRepository.GenerateStub<HttpContextBase>();
            var viewContext = MockRepository.GenerateStub<ViewContext>();
            var httpRequest = MockRepository.GenerateStub<HttpRequestBase>();
            httpContext.Stub(c => c.Request).Return(httpRequest).Repeat.Any();
            httpRequest.Stub(c => c.ApplicationPath).Return("http://localhost/CometGateway.Server.TelnetDemo");
            viewContext.HttpContext = httpContext;
            viewContext.RequestContext = new RequestContext( httpContext, new RouteData() );

            var viewData = new ViewDataDictionary() {{TestModeConstants.ENABLE_TEST_MODE, true}};
            viewContext.ViewData = viewData;
            var view = new WebFormView("~/Views/Main/Index.aspx");
            viewContext.View = view;

            var html = new HtmlHelper( viewContext, new ViewPage() );
            html.ViewDataContainer.ViewData = viewData;

            const string expectedSnippet =
              @"
            <link href=""http://localhost/CometGateway.Server.TelnetDemo/Content/QUnit.css"" rel=""stylesheet"" type=""text/css""></link>
            <script src=""http://localhost/CometGateway.Server.TelnetDemo/Scripts/qunit.js"" type=""text/javascript""></script>
            <script src=""http://localhost/CometGateway.Server.TelnetDemo/Scripts/Views/Main/IndexTest.js"" type=""text/javascript""></script>
            <div id='testResults'>
            <h1 id='qunit-header'></h1>
            <h2 id='qunit-banner'></h2>
            <h2 id='qunit-userAgent'></h2>
            <ol id='qunit-tests'></ol>
            <div id='qunit-fixture'></div>
            </div>
            <script type='text/javascript'>var testmode = true;</script>
            <script type='text/javascript'>
            $('body').contents().hide();
            $('#testResults').show();
            </script>";
            TestUtilities.AssertStringsMatch( expectedSnippet, html.EnableQUnitTesting());
        }
开发者ID:Mitch-Constantine,项目名称:CometGateway,代码行数:37,代码来源:EnableQUnitTest.cs


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