Esempio n. 1
0
		public void RenderNextPane_Throws_Exception_When_Tabs_Are_Added_Dynamically()
		{
			// Arrange
			var resp = new MockWriter();
			Tabs tabs = new Tabs(resp, "myTabs");

			// define the test tabs
			tabs
				.AsDynamic()
				.Panes
				.Add("http://someurl.com/tab1", "Tab 1")
				.Add("http://someurl.com/tab2", "Tab 2")
				.Add("http://someurl.com/tab3", "Tab 3")
			;

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

			// This should throw a wobbler
			TestHelper.ForceRender(tabs);

			Assert.Fail("NotSupportedException should have been thrown.");
		}
Esempio n. 2
0
		public void Pretty_Dynamic_Tabs_Script_Renders_Correctly()
		{
			// Arrange
			var resp = new MockWriter();
			Tabs tabs = new Tabs(resp, "myTabs");

			// define the test tabs
			tabs
				.AsDynamic()
				.Panes
				.Add("http://someurl.com/tab1", "Tab 1")
				.Add("http://someurl.com/tab2", "Tab 2")
				.Add("http://someurl.com/tab3", "Tab 3")
			;

			// only testing raw output
			tabs
				.Rendering
					.SetAutoScript(false)
					.SetPrettyRender(true)
			;

			using (tabs.RenderHeader()) {
			}

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

			// Assert
			string expected = 
				"<div id=\"myTabs\">" + Environment.NewLine +
				"	<ul>" + Environment.NewLine + 
				"		<li>" + Environment.NewLine +
				"			<a href=\"http://someurl.com/tab1\"><span>Tab 1</span></a>" + Environment.NewLine +
				"		</li>" + Environment.NewLine +
				"		<li>" + Environment.NewLine +
				"			<a href=\"http://someurl.com/tab2\"><span>Tab 2</span></a>" + Environment.NewLine +
				"		</li>" + Environment.NewLine +
				"		<li>" + Environment.NewLine +
				"			<a href=\"http://someurl.com/tab3\"><span>Tab 3</span></a>" + Environment.NewLine +
				"		</li>" + Environment.NewLine +
				"	</ul>" + Environment.NewLine +
				"</div>" + Environment.NewLine;

			Assert.AreEqual(expected, html);
		}