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.
29 using System.Collections.Generic;
30 using System.Configuration;
31 using System.Configuration.Provider;
34 using System.Web.Hosting;
36 using StandAloneRunnerSupport;
37 using StandAloneTests;
39 using NUnit.Framework;
41 namespace StandAloneTests.WebFormsRouting
43 [TestCase ("WebFormsRouting 01", "Web forms routing")]
44 public sealed class WebFormsRouting_01 : ITestCase
46 public string PhysicalPath {
48 return Path.Combine (Consts.BasePhysicalDir, "WebFormsRouting");
52 public string VirtualPath {
56 public bool SetUp (List <TestRunItem> runItems)
58 runItems.Add (new TestRunItem ("/Default.aspx", Default_Aspx));
59 runItems.Add (new TestRunItem ("/search/test", Search_Test));
60 runItems.Add (new TestRunItem ("/search/true", Search_True));
61 runItems.Add (new TestRunItem ("/search/red", Search_Red));
66 void Default_Aspx (string result, TestRunItem runItem)
68 string originalHtml = @"<a href=""/search/test"">Search for 'test'</a>";
70 Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
73 void Search_Test (string result, TestRunItem runItem)
75 string originalHtml = @"Search term is: <span id=""label1"">test</span><br />
76 Search term from expression is: <span id=""label2"">test</span><br />
77 <pre id=""testLog"">.: Missing key (key: 'SearchTermd')
79 .: Missing property (key: 'SearchTerm')
80 Returned value of type 'System.String': test
81 .: No converter (key: 'SearchTerm')
82 Returned value of type 'System.String': test
83 .: Valid conversion to target (key: 'SearchTerm')
84 Exception 'System.FormatException' caught
85 .: Invalid conversion to target (key: 'SearchTerm')
86 Exception 'System.Exception' caught
87 .: Complex type converter (key: 'SearchTerm')
88 Exception 'System.Exception' caught
89 .: Null controlType (key: 'SearchTerm')
90 Returned value of type 'System.String': test
91 .: Null propertyName (key: 'SearchTerm')
92 Returned value of type 'System.String': test
93 .: Empty propertyName (key: 'SearchTerm')
94 Returned value of type 'System.String': test
95 .: Non-string value (key: 'intValue')
96 Returned value of type 'System.Int32': 123
97 .: Non-string value (key: 'boolValue')
98 Returned value of type 'System.Boolean': False
99 .: Non-string value (key: 'doubleValue')
100 Returned value of type 'System.Double': 1,23
103 Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
106 void Search_True (string result, TestRunItem runItem)
108 string originalHtml = @"Search term is: <span id=""label1"">true</span><br />
109 Search term from expression is: <span id=""label2"">true</span><br />
110 <pre id=""testLog"">.: Missing key (key: 'SearchTermd')
112 .: Missing property (key: 'SearchTerm')
113 Returned value of type 'System.String': true
114 .: No converter (key: 'SearchTerm')
115 Returned value of type 'System.String': true
116 .: Valid conversion to target (key: 'SearchTerm')
117 Returned value of type 'System.Boolean': True
118 .: Invalid conversion to target (key: 'SearchTerm')
119 Exception 'System.Exception' caught
120 .: Complex type converter (key: 'SearchTerm')
121 Exception 'System.Exception' caught
122 .: Null controlType (key: 'SearchTerm')
123 Returned value of type 'System.String': true
124 .: Null propertyName (key: 'SearchTerm')
125 Returned value of type 'System.String': true
126 .: Empty propertyName (key: 'SearchTerm')
127 Returned value of type 'System.String': true
128 .: Non-string value (key: 'intValue')
129 Returned value of type 'System.Int32': 123
130 .: Non-string value (key: 'boolValue')
131 Returned value of type 'System.Boolean': False
132 .: Non-string value (key: 'doubleValue')
133 Returned value of type 'System.Double': 1,23
136 Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
139 void Search_Red (string result, TestRunItem runItem)
141 string originalHtml = @"Search term is: <span id=""label1"">red</span><br />
142 Search term from expression is: <span id=""label2"">red</span><br />
143 <pre id=""testLog"">.: Missing key (key: 'SearchTermd')
145 .: Missing property (key: 'SearchTerm')
146 Returned value of type 'System.String': red
147 .: No converter (key: 'SearchTerm')
148 Returned value of type 'System.String': red
149 .: Valid conversion to target (key: 'SearchTerm')
150 Exception 'System.FormatException' caught
151 .: Invalid conversion to target (key: 'SearchTerm')
152 Exception 'System.Exception' caught
153 .: Complex type converter (key: 'SearchTerm')
154 Returned value of type 'System.Drawing.Color': Color [Red]
155 .: Null controlType (key: 'SearchTerm')
156 Returned value of type 'System.String': red
157 .: Null propertyName (key: 'SearchTerm')
158 Returned value of type 'System.String': red
159 .: Empty propertyName (key: 'SearchTerm')
160 Returned value of type 'System.String': red
161 .: Non-string value (key: 'intValue')
162 Returned value of type 'System.Int32': 123
163 .: Non-string value (key: 'boolValue')
164 Returned value of type 'System.Boolean': False
165 .: Non-string value (key: 'doubleValue')
166 Returned value of type 'System.Double': 1,23
169 Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");