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.PageParserDefaultTypeProperties
43 [TestCase ("PageParserDefaultTypeProperties 01", "Tests for PageParser.Default*Type properties")]
44 public sealed class PageParserDefaultTypeProperties_01 : ITestCase
46 static string[] expectedMessages_1 = {
47 "1: DefaultApplicationBaseType: set",
48 "1: DefaultPageBaseType: set",
49 "1: DefaultPageParserFilterType: set",
50 "1: DefaultUserControlBaseType: set"
53 static string[] expectedMessages_2 = {
54 "2: DefaultApplicationBaseType: exception 'System.ArgumentException' thrown.",
55 "2: DefaultPageBaseType: exception 'System.ArgumentException' thrown.",
56 "2: DefaultPageParserFilterType: exception 'System.ArgumentException' thrown.",
57 "2: DefaultUserControlBaseType: exception 'System.ArgumentException' thrown."
60 static string[] expectedMessages_3 = {
61 "3: DefaultApplicationBaseType: set",
62 "3: DefaultPageBaseType: set",
63 "3: DefaultPageParserFilterType: set",
64 "3: DefaultUserControlBaseType: set"
67 public string PhysicalPath {
69 return Path.Combine (Consts.BasePhysicalDir, "PageParserDefaultTypeProperties");
73 public string VirtualPath {
77 public bool SetUp (List <TestRunItem> runItems)
80 new TestRunItem ("/default.aspx", "Set correct values", Default_Aspx_1) {
81 AppDomainData = new object[] { "TestNumber", 1 }
85 new TestRunItem ("/default.aspx", "Set invalid values", Default_Aspx_2) {
86 AppDomainData = new object[] { "TestNumber", 2 }
90 new TestRunItem ("/default.aspx", "Set null values", Default_Aspx_3) {
91 AppDomainData = new object[] { "TestNumber", 3 }
98 void Default_Aspx_1 (string result, TestRunItem runItem)
100 CheckResults (runItem.TestRunData as List <string>, expectedMessages_1);
103 void Default_Aspx_2 (string result, TestRunItem runItem)
105 CheckResults (runItem.TestRunData as List <string>, expectedMessages_2);
108 void Default_Aspx_3 (string result, TestRunItem runItem)
110 CheckResults (runItem.TestRunData as List <string>, expectedMessages_3);
113 void CheckResults (List <string> messages, string[] expectedMessages)
115 Assert.IsNotNull (messages, "#A1");
117 int len = messages.Count;
118 if (expectedMessages.Length != len)
119 Assert.Fail ("Expected {0} messages, found {1}", expectedMessages.Length, len);
121 for (int i = 0; i < len; i++)
122 Assert.AreEqual (expectedMessages [i], messages [i], "#A2-" + i.ToString ());