• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Mocks.MockWriter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Fluqi.Tests.Mocks.MockWriter的典型用法代码示例。如果您正苦于以下问题:C# MockWriter类的具体用法?C# MockWriter怎么用?C# MockWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MockWriter类属于Fluqi.Tests.Mocks命名空间,在下文中一共展示了MockWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Tab_Marked_As_Selected_Has_Correct_Styling_And_JavaScript

		public void Tab_Marked_As_Selected_Has_Correct_Styling_And_JavaScript()
		{
			// Arrange
			var resp = new MockWriter();
			Tabs tabs = TestHelper.SetupSimpleTabObject(resp);

			// only testing raw output
			tabs
				.Rendering
					.Compress()
					.ShowCSS()
			;

			// Set 3rd tab as selected
			tabs.Panes.ToDictionary()["tab3"].IsActive = true;

			TestHelper.ForceRender(tabs);

			// Act - Force output we'd see on the web page
			string html = resp.Output.ToString();

			// Assert
			// Check styling is correct
			Assert.IsTrue(html.Contains("<li class=\"ui-state-default ui-corner-top ui-tabs-active ui-state-active\">") );
			string expected = 
				"<script type=\"text/javascript\">" + 
					"$(document).ready( function() {" + 
						"$(\"#myTabs\").tabs({active: 2})" + 
					";});" + 
				"</script>";

			// Check script output
			Assert.IsTrue(html.Contains(expected));
		}
开发者ID:akhuang,项目名称:Fluqi,代码行数:34,代码来源:TabTests-Options.cs


示例2: Button_Option_Disabled_Renders_Correctly

		public void Button_Option_Disabled_Renders_Correctly()
		{
			// Arrange
			var resp = new MockWriter();
			PushButton btn = TestHelper.SetupSimpleButtonObject(resp);

			// only testing raw output
			btn
				.Options
					.SetDisabled(true)
					.Finish()
				.Rendering
					.Compress()
					.ShowCSS()
			;

			// Act - Force output we'd see on the web page
			btn.Render();
			string html = resp.Output.ToString();

		  // Assert
		  string expected = 
		    "<script type=\"text/javascript\">" + 
		      "$(document).ready( function() {" + 
		        "$(\"#btn\").button({disabled: true})" + 
		      ";});" + 
		    "</script>";
		  Assert.IsTrue(html.Contains(expected));
		}
开发者ID:xuanvu,项目名称:Fluqi,代码行数:29,代码来源:ButtonTests-Options.cs


示例3: Ensure_My_Option_With_Position_Enum_Is_Added_To_Script_Definition

		public void Ensure_My_Option_With_Position_Enum_Is_Added_To_Script_Definition()
		{
			// Arrange
			var resp = new MockWriter();
			Position pos = TestHelper.SetupSimplePositionObject(resp);

			// only testing raw output
			pos
				.Rendering
					.Compress()
				.Finish()
				.Options
					.SetMy(Fluqi.Core.Position.ePosition.Right)
			;

			TestHelper.ForceRender(pos);

			// Act - Force output we'd see on the web page
			string html = resp.Output.ToString();

			// Assert
			string expected = 
				"<script type=\"text/javascript\">" + 
					"$(document).ready( function() {" + 
						"$(\"#myPosition\").position({my: \"right\"})" + 
					";});" + 
				"</script>";

			Assert.IsTrue(html.Contains(expected));
		}
开发者ID:xuanvu,项目名称:Fluqi,代码行数:30,代码来源:PositionTests-Option.cs


示例4: Accordion_With_Full_CSS_Delivers_Correct_CSS_Classes

		public void Accordion_With_Full_CSS_Delivers_Correct_CSS_Classes()
		{
		  // Arrange
		  var resp = new MockWriter();
			var accordion = TestHelper.SetupSimpleAccordionObject(resp);

		  // only testing raw output
		  accordion
				.Rendering
					.Compress()
					.ShowCSS()
			;
			
			TestHelper.ForceRender(accordion);

			// Act
		  string html = resp.Output.ToString();

		  // Assert
		  Assert.IsTrue(html.Contains("id=\"myAccordion\""));

		  Assert.AreEqual(1, Utils.NumberOfMatches(html, "<div id=\"myAccordion\" class=\"ui-accordion ui-widget ui-helper-reset ui-accordion-icons\">") );

			// Test the Active panel
		  Assert.AreEqual(1, Utils.NumberOfMatches(html, "<h3 class=\"ui-accordion-header ui-helper-reset ui-state-default ui-state-active ui-corner-top\">") );

			// Test the InActive panel(s)
		  Assert.AreEqual(2, Utils.NumberOfMatches(html, "<h3 class=\"ui-accordion-header ui-helper-reset ui-state-default ui-corner-all\">") );

			// Test the content panels, which _always_ have "ui-accordion-content-active" (see https://github.com/toepoke/Fluqi/issues/1)
		  Assert.AreEqual(3, Utils.NumberOfMatches(html, "<div class=\"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active\">") );
		}
开发者ID:akhuang,项目名称:Fluqi,代码行数:32,代码来源:AccordionTests-Core.cs


示例5: Ensure_Disabled_Option_Is_Added_To_Script_Definition

		public void Ensure_Disabled_Option_Is_Added_To_Script_Definition()
		{
			// Arrange
			var resp = new MockWriter();
			Slider sldr = TestHelper.SetupSimpleSliderObject(resp);

			// only testing raw output
			sldr
				.Options
					.SetDisabled(true)
					.Finish()
				.Rendering
					.Compress();

			TestHelper.ForceRender(sldr);

			// Act - Force output we'd see on the web page
			string html = resp.Output.ToString();

			// Assert
			string expected = 
				"<script type=\"text/javascript\">" + 
					"$(document).ready( function() {" + 
						"$(\"#mySlider\").slider({disabled: true})" + 
					";});" + 
				"</script>";

			Assert.IsTrue(html.Contains(expected));
		}
开发者ID:xuanvu,项目名称:Fluqi,代码行数:29,代码来源:SliderTests-Options.cs


示例6: Ensure_Two_Buttons_Are_Added_To_Script_Definition_Correctly

		public void Ensure_Two_Buttons_Are_Added_To_Script_Definition_Correctly()
		{
			// Arrange
			var resp = new MockWriter();
			Dialog dlg = TestHelper.SetupSimpleDialogObject(resp);

			// only testing raw output
			dlg
				.Options
					.AddButton("OK", "addToLog('OK button clicked.');")
					.AddButton("Cancel", "addToLog('Cancel button clicked.');")
					.Finish()
				.Rendering
					.Compress()
			;
	
			TestHelper.ForceRender(dlg);
			
			// Act - Force output we'd see on the web page
			string html = resp.Output.ToString();

			// Assert
			string expected = 
				"<script type=\"text/javascript\">" + 
					"$(document).ready( function() {" + 
						"$(\"#myDlg\").dialog({buttons: {\"OK\": function() {addToLog('OK button clicked.');},\"Cancel\": function() {addToLog('Cancel button clicked.');}}})" + 
					";});" + 
				"</script>";
			Assert.IsTrue(html.Contains(expected));
		}		
开发者ID:xuanvu,项目名称:Fluqi,代码行数:30,代码来源:DialogTests-Buttons.cs


示例7: Ensure_Icons_By_String_Option_Is_Added_To_Script_Definition

		public void Ensure_Icons_By_String_Option_Is_Added_To_Script_Definition()
		{
		  // Arrange
		  var resp = new MockWriter();
		  Menu menu = TestHelper.SetupSimpleMenuObject(resp);

		  // only testing raw output
		  menu
		    .Options
		      .SetIcons("abcxyz")
		      .Finish()
		    .Rendering
		      .Compress();

		  TestHelper.ForceRender(menu);

		  // Act - Force output we'd see on the web page
		  string html = resp.Output.ToString();

		  // Assert
		  string expected = 
		    "<script type=\"text/javascript\">" + 
		      "$(document).ready( function() {" + 
		        "$(\"#myMenu\").menu({icons: { submenu: \"abcxyz\" }})" + 
		      ";});" + 
		    "</script>";

		  Assert.IsTrue(html.Contains(expected));
		}
开发者ID:akhuang,项目名称:Fluqi,代码行数:29,代码来源:MenuTests-Options.cs


示例8: Ensure_Populated_ContentByString_Option_Is_Added_To_Script_Definition

	  public void Ensure_Populated_ContentByString_Option_Is_Added_To_Script_Definition()
	  {
	    // Arrange
	    var resp = new MockWriter();
	    ToolTip tooltip = TestHelper.SetupSimpleToolTipObject(resp);

	    // only testing raw output
	    tooltip
	      .Options
	        .SetContentByString("Awesome title!")
	        .Finish()
	      .Rendering
	        .Compress();

	    TestHelper.ForceRender(tooltip);

	    // Act - Force output we'd see on the web page
	    string html = resp.Output.ToString();

	    // Assert
	    string expected = 
	      "<script type=\"text/javascript\">" + 
	        "$(document).ready( function() {" + 
	          "$(document).tooltip({content: \"Awesome title!\"})" + 
	        ";});" + 
	      "</script>";

	    Assert.IsTrue(html.Contains(expected));
	  }
开发者ID:toepoke,项目名称:Fluqi,代码行数:29,代码来源:ToolTipTests-Options.cs


示例9: AutoComplete_Option_AppendTo_Renders_Correctly

		public void AutoComplete_Option_AppendTo_Renders_Correctly()
		{
			// Arrange
			var resp = new MockWriter();
			AutoComplete ac = TestHelper.SetupSimpleAutoCompleteObject(resp);

			// only testing raw output
			ac
				.Options
					.SetAppendTo("#my-element")
					.Finish()
				.Rendering
					.Compress()
				.ShowCSS()
			;

			// Act - Force output we'd see on the web page
			ac.Render();
			string html = resp.Output.ToString();

		  // Assert
		  string expected = 
		    "<script type=\"text/javascript\">" + 
		      "$(document).ready( function() {" + 
		        "$(\"#ac\").autocomplete({source: ['c++', 'java', 'php'],appendTo: \"#my-element\"})" + 
		      ";});" + 
		    "</script>";
		  Assert.IsTrue(html.Contains(expected));
		}
开发者ID:xuanvu,项目名称:Fluqi,代码行数:29,代码来源:AutoCompleteTests-Options.cs


示例10: AutoComplete_With_Search_EventHandler_Wired_Up_Renders_Correctly

		public void AutoComplete_With_Search_EventHandler_Wired_Up_Renders_Correctly()
		{
			// Arrange
			var resp = new MockWriter();
			AutoComplete ac = TestHelper.SetupSimpleAutoCompleteObject(resp);

			// only testing raw output
			ac
				.Options
					.Finish()
				.Rendering
					.Compress()
				.ShowCSS()
			;
			ac.Events
				.SetSearchEvent("addToLog('Search event called');")
			;

			// Act - Force output we'd see on the web page
			ac.Render();
			string html = resp.Output.ToString();

		  // Assert
		  string expected = "search: function(event, ui) {addToLog('Search event called');}";
		  Assert.IsTrue(html.Contains(expected));
		}
开发者ID:xuanvu,项目名称:Fluqi,代码行数:26,代码来源:AutoCompleteTests-Events.cs


示例11: Ensure_Multiple_Options_Are_Added_To_Script_Definition_Correctly

		public void Ensure_Multiple_Options_Are_Added_To_Script_Definition_Correctly()
		{
			// Arrange
			var resp = new MockWriter();
			AutoComplete ac = TestHelper.SetupSimpleAutoCompleteObject(resp);

			// only testing raw output
			ac
				.Options
					.SetDisabled(true)
					.SetMinimumLength(3)
					.Finish()
				.Rendering
					.Compress()
					.ShowCSS()
			;

			// Act - Force output we'd see on the web page
			ac.Render();
			string html = resp.Output.ToString();

		  // Assert
		  string expected = 
		    "<script type=\"text/javascript\">" + 
		      "$(document).ready( function() {" + 
		        "$(\"#ac\").autocomplete({disabled: true,source: ['c++', 'java', 'php'],minLength: 3})" + 
		      ";});" + 
		    "</script>";
		  Assert.IsTrue(html.Contains(expected));
		}
开发者ID:xuanvu,项目名称:Fluqi,代码行数:30,代码来源:AutoCompleteTests-Options.cs


示例12: Tabs_With_Full_CSS_Delivers_Correct_CSS_Classes

		public void Tabs_With_Full_CSS_Delivers_Correct_CSS_Classes()
		{
			// Arrange
			var resp = new MockWriter();
			Tabs tabs = TestHelper.SetupSimpleTabObject(resp);

			// only testing raw output
			tabs
				.Rendering
					.Compress()
					.ShowCSS()
			;

			TestHelper.ForceRender(tabs);
			
			// Act - Force output we'd see on the web page
			string html = resp.Output.ToString();

			// Assert
			Assert.IsTrue(html.Contains("id=\"myTabs\""));

			Assert.AreEqual(1, Utils.NumberOfMatches(html, "<div id=\"myTabs\" class=\"ui-tabs ui-widget ui-widget-content ui-corner-all\">") );
			Assert.AreEqual(1, Utils.NumberOfMatches(html, "<ul class=\"ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all\">") );

			// Should be 3 of these (one for each LI header, but first one is selected)
			Assert.AreEqual(1, Utils.NumberOfMatches(html, "<li class=\"ui-state-default ui-corner-top ui-tabs-selected ui-state-active\">") );
			Assert.AreEqual(2, Utils.NumberOfMatches(html, "<li class=\"ui-state-default ui-corner-top\">") );

			// Should be 3 of these (one for each content pane)
			Assert.AreEqual(3, Utils.NumberOfMatches(html, "class=\"ui-tabs-panel ui-widget-content ui-corner-bottom\"") );
		}
开发者ID:xuanvu,项目名称:Fluqi,代码行数:31,代码来源:TabTests-Core.cs


示例13: Tabs_With_No_CSS_Renders_Correct_Structure

		public void Tabs_With_No_CSS_Renders_Correct_Structure()
		{
			// Arrange
			var resp = new MockWriter();
			Tabs tabs = TestHelper.SetupSimpleTabObject(resp);

			// only testing raw output
			tabs
				.Rendering
					.Compress()
			;

			TestHelper.ForceRender(tabs);

			// Act - Force output we'd see on the web page
			string html = resp.Output.ToString();

			// Assert
			Assert.IsTrue(html.Contains("id=\"myTabs\""));

			// Should be:
			// 1 UL
			Assert.AreEqual(1, Utils.NumberOfMatches(html, "<ul") );
			Assert.AreEqual(1, Utils.NumberOfMatches(html, "</ul") );

			// 3 LI
			Assert.AreEqual(3, Utils.NumberOfMatches(html, "<li") );
			Assert.AreEqual(3, Utils.NumberOfMatches(html, "</li") );

			// 3 content panels
			Assert.AreEqual(3, Utils.NumberOfMatches(html, "<div id=\"tab") );
		}
开发者ID:xuanvu,项目名称:Fluqi,代码行数:32,代码来源:TabTests-Core.cs


示例14: Tabs_With_BeforeActivate_EventHandler_Wired_Up_Renders_Correctly

		public void Tabs_With_BeforeActivate_EventHandler_Wired_Up_Renders_Correctly()
		{
			// Arrange
			// Arrange
			var resp = new MockWriter();
			Tabs tabs = TestHelper.SetupSimpleTabObject(resp);

			// only testing raw output
			tabs
				.Options
					.SetEvent("mouseover")
				.Finish()
				.Rendering
					.Compress();

			tabs.Events
				.SetBeforeActivateEvent("addToLog('beforeActivate event called');")
			;

			TestHelper.ForceRender(tabs);

			// Act - Force output we'd see on the web page
			string html = resp.Output.ToString();

		  // Assert
		  string expected = "beforeActivate: function(event, ui) {addToLog('beforeActivate event called');}";
		  Assert.IsTrue(html.Contains(expected));
		}
开发者ID:akhuang,项目名称:Fluqi,代码行数:28,代码来源:TabTests-Events.cs


示例15: Menu_With_Full_CSS_Delivers_Correct_CSS_Classes

		public void Menu_With_Full_CSS_Delivers_Correct_CSS_Classes()
		{
		  // Arrange
		  var resp = new MockWriter();
		  Menu menu = TestHelper.SetupSimpleMenuObject(resp);

		  // only testing raw output
		  menu
				.Items()
					.Add("Item 1")
				.Finish()
		    .Rendering
		      .Compress()
		      .ShowCSS()
		  ;

		  TestHelper.ForceRender(menu);
			
		  // Act - Force output we'd see on the web page
		  string html = resp.Output.ToString();

		  // Assert - UL root
			Assert.AreEqual(1, Utils.NumberOfMatches(html, "<ul id=\"myMenu\" class=\"ui-menu ui-widget ui-widget-content ui-corner-all\">"));
			// Assert - LI
		  Assert.AreEqual(1, Utils.NumberOfMatches(html, "<li class=\"ui-menu-item\"><a href=\"#\" class=\"ui-corner-all\">Item 1</a></li>") );
			// Assert - A
			Assert.AreEqual(1, Utils.NumberOfMatches(html, "<a href=\"#\" class=\"ui-corner-all\">Item 1</a>") );
		}
开发者ID:toepoke,项目名称:Fluqi,代码行数:28,代码来源:MenuTests-Core.cs


示例16: With_Addition_Attributes_Are_Rendered

		public void With_Addition_Attributes_Are_Rendered()
		{
		  // Arrange
		  var resp = new MockWriter();
		  SelectMenu selectMenu = TestHelper.SetupSimpleSelectMenuObject(resp);

			selectMenu
				.WithAttribute("name", "select-name")
				.Items()
					.Add("Item 1", "1")
						.ConfigureItem()
							.WithAttribute("data-class", "podcast")
						.Finish()
					.Finish()
			;

		  TestHelper.ForceRender(selectMenu);
			
		  // Act - Force output we'd see on the web page
		  string html = resp.Output.ToString();

		  // Assert
		  Assert.IsTrue(html.Contains("name=\"select-name\""));
		  Assert.IsTrue(html.Contains("data-class=\"podcast\""));
		}
开发者ID:toepoke,项目名称:Fluqi,代码行数:25,代码来源:SelectMenuTests-Core.cs


示例17: Ensure_Collapsible_Option_Is_Added_To_Script_Definition

		public void Ensure_Collapsible_Option_Is_Added_To_Script_Definition()
		{
		  // Arrange
		  var resp = new MockWriter();
			var accordion = TestHelper.SetupSimpleAccordionObject(resp);

		  // only testing raw output
		  accordion
				.Rendering
					.Compress()
					.Finish()
				.Options
					.SetCollapsible(true)
			;

			TestHelper.ForceRender(accordion);

		  // Act - Force output we'd see on the web page
		  string html = resp.Output.ToString();

		  // Assert
		  string expected = 
				"<script type=\"text/javascript\">" + 
					"$(document).ready( function() {" + 
						"$(\"#myAccordion\").accordion({collapsible: true});" + 
					"});" + 
				"</script>";
		  Assert.IsTrue(html.Contains(expected));
		}
开发者ID:akhuang,项目名称:Fluqi,代码行数:29,代码来源:AccordionTests-Options.cs


示例18: DatePicker_Option_AltField_Renders_Correctly

		public void DatePicker_Option_AltField_Renders_Correctly()
		{
		  // Arrange
		  var resp = new MockWriter();
		  DatePicker ac = TestHelper.SetupSimpleDatePickerObject(resp);

		  // only testing raw output
		  ac
				.Options
					.SetAltField("#my-element")
					.Finish()
				.Rendering
			    .Compress()
			    .ShowCSS()
		  ;

		  // Act - Force output we'd see on the web page
		  ac.Render();
		  string html = resp.Output.ToString();

		  // Assert
		  string expected = 
		    "<script type=\"text/javascript\">" + 
		      "$(document).ready( function() {" + 
		        "$(\"#dt\").datepicker({altField: \"#my-element\"})" + 
		      ";});" + 
		    "</script>";
		  Assert.IsTrue(html.Contains(expected));
		}
开发者ID:xuanvu,项目名称:Fluqi,代码行数:29,代码来源:DatePickerTests-Options.cs


示例19: Ensure_AppendTo_Option_Is_Added_To_Script_Definition

		public void Ensure_AppendTo_Option_Is_Added_To_Script_Definition()
		{
		  // Arrange
		  var resp = new MockWriter();
		  var ctl = TestHelper.SetupSimpleSelectMenuObject(resp);

		  // only testing raw output
		  ctl
		    .Options
		      .SetAppendTo("#someElem")
		      .Finish()
		    .Rendering
		      .Compress()
				.Finish()
			;

		  TestHelper.ForceRender(ctl);

		  // Act - Force output we'd see on the web page
		  string html = resp.Output.ToString();

		  // Assert
		  string expected = 
		    "<script type=\"text/javascript\">" + 
		      "$(document).ready( function() {" + 
		        "$(\"#mySelectMenu\").selectmenu({appendTo: \"#someElem\"})" + 
		      ";});" + 
		    "</script>";

		  Assert.IsTrue(html.Contains(expected));
		}
开发者ID:toepoke,项目名称:Fluqi,代码行数:31,代码来源:SelectMenuTests-Options.cs


示例20: Ensure_One_Button_And_Other_Options_Are_Added_To_Script_Definition_Correctly

		public void Ensure_One_Button_And_Other_Options_Are_Added_To_Script_Definition_Correctly()
		{
			// Arrange
			var resp = new MockWriter();
			Dialog dlg = TestHelper.SetupSimpleDialogObject(resp);

			// only testing raw output
			dlg
				.Options
					.AddButton("OK", "addToLog('OK button clicked.');")
					.SetDisabled(true)
					.SetPosition( Core.Position.ePosition.Left, Core.Position.ePosition.Top )
					.Finish()
				.Rendering
					.Compress()
			;
	
			TestHelper.ForceRender(dlg);
			
			// Act - Force output we'd see on the web page
			string html = resp.Output.ToString();

			// Assert
			string expected = 
				"<script type=\"text/javascript\">" + 
					"$(document).ready( function() {" + 
						"$(\"#myDlg\").dialog({disabled: true,position: [ 'left', 'top' ],buttons: {\"OK\": function() {addToLog('OK button clicked.');}}})" + 
					";});" + 
				"</script>";
			Assert.IsTrue(html.Contains(expected));
		}		
开发者ID:xuanvu,项目名称:Fluqi,代码行数:31,代码来源:DialogTests-Buttons.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forays.PhysicalObject类代码示例发布时间:2022-05-26
下一篇:
C# Helpers.jStringBuilder类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap