3 // Marek Habersack (mhabersack@novell.com)
5 // (C) 2010 Novell, Inc http://novell.com/
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 using System.Collections.Generic;
31 using System.Configuration;
32 using System.Configuration.Provider;
35 using System.Web.Hosting;
37 using StandAloneRunnerSupport;
38 using StandAloneTests;
40 using NUnit.Framework;
42 namespace StandAloneTests.WebFormsRouting
44 [TestCase ("WebFormsRouting 01", "Web forms routing")]
45 public sealed class WebFormsRouting_01 : ITestCase
47 public string PhysicalPath {
49 return Path.Combine (Consts.BasePhysicalDir, "WebFormsRouting");
53 public string VirtualPath {
57 public bool SetUp (List <TestRunItem> runItems)
59 runItems.Add (new TestRunItem ("/Default.aspx", Default_Aspx));
60 runItems.Add (new TestRunItem ("/search/test", Search_Test));
61 runItems.Add (new TestRunItem ("/search/true", Search_True));
62 runItems.Add (new TestRunItem ("/search/red", Search_Red));
67 void Default_Aspx (string result, TestRunItem runItem)
69 string originalHtml = @"<a href=""/search/test"">Search for 'test'</a>";
71 Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
74 void Search_Test (string result, TestRunItem runItem)
76 string originalHtml = @"Search term is: <span id=""label1"">test</span><br />
77 Search term from expression is: <span id=""label2"">test</span><br />
78 <pre id=""testLog"">.: Missing key (key: 'SearchTermd')
80 .: Missing property (key: 'SearchTerm')
81 Returned value of type 'System.String': test
82 .: No converter (key: 'SearchTerm')
83 Returned value of type 'System.String': test
84 .: Valid conversion to target (key: 'SearchTerm')
85 Exception 'System.FormatException' caught
86 .: Invalid conversion to target (key: 'SearchTerm')
87 Exception 'System.Exception' caught
88 .: Complex type converter (key: 'SearchTerm')
89 Exception 'System.Exception' caught
90 .: Null controlType (key: 'SearchTerm')
91 Returned value of type 'System.String': test
92 .: Null propertyName (key: 'SearchTerm')
93 Returned value of type 'System.String': test
94 .: Empty propertyName (key: 'SearchTerm')
95 Returned value of type 'System.String': test
96 .: Non-string value (key: 'intValue')
97 Returned value of type 'System.Int32': 123
98 .: Non-string value (key: 'boolValue')
99 Returned value of type 'System.Boolean': False
100 .: Non-string value (key: 'doubleValue')
101 Returned value of type 'System.Double': 1,23
104 Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
107 void Search_True (string result, TestRunItem runItem)
109 string originalHtml = @"Search term is: <span id=""label1"">true</span><br />
110 Search term from expression is: <span id=""label2"">true</span><br />
111 <pre id=""testLog"">.: Missing key (key: 'SearchTermd')
113 .: Missing property (key: 'SearchTerm')
114 Returned value of type 'System.String': true
115 .: No converter (key: 'SearchTerm')
116 Returned value of type 'System.String': true
117 .: Valid conversion to target (key: 'SearchTerm')
118 Returned value of type 'System.Boolean': True
119 .: Invalid conversion to target (key: 'SearchTerm')
120 Exception 'System.Exception' caught
121 .: Complex type converter (key: 'SearchTerm')
122 Exception 'System.Exception' caught
123 .: Null controlType (key: 'SearchTerm')
124 Returned value of type 'System.String': true
125 .: Null propertyName (key: 'SearchTerm')
126 Returned value of type 'System.String': true
127 .: Empty propertyName (key: 'SearchTerm')
128 Returned value of type 'System.String': true
129 .: Non-string value (key: 'intValue')
130 Returned value of type 'System.Int32': 123
131 .: Non-string value (key: 'boolValue')
132 Returned value of type 'System.Boolean': False
133 .: Non-string value (key: 'doubleValue')
134 Returned value of type 'System.Double': 1,23
137 Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
140 void Search_Red (string result, TestRunItem runItem)
142 string originalHtml = @"Search term is: <span id=""label1"">red</span><br />
143 Search term from expression is: <span id=""label2"">red</span><br />
144 <pre id=""testLog"">.: Missing key (key: 'SearchTermd')
146 .: Missing property (key: 'SearchTerm')
147 Returned value of type 'System.String': red
148 .: No converter (key: 'SearchTerm')
149 Returned value of type 'System.String': red
150 .: Valid conversion to target (key: 'SearchTerm')
151 Exception 'System.FormatException' caught
152 .: Invalid conversion to target (key: 'SearchTerm')
153 Exception 'System.Exception' caught
154 .: Complex type converter (key: 'SearchTerm')
155 Returned value of type 'System.Drawing.Color': Color [Red]
156 .: Null controlType (key: 'SearchTerm')
157 Returned value of type 'System.String': red
158 .: Null propertyName (key: 'SearchTerm')
159 Returned value of type 'System.String': red
160 .: Empty propertyName (key: 'SearchTerm')
161 Returned value of type 'System.String': red
162 .: Non-string value (key: 'intValue')
163 Returned value of type 'System.Int32': 123
164 .: Non-string value (key: 'boolValue')
165 Returned value of type 'System.Boolean': False
166 .: Non-string value (key: 'doubleValue')
167 Returned value of type 'System.Double': 1,23
170 Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");