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


C# Mocks.MockWriter类代码示例

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


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


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