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;
32 using System.Web.Util;
34 using StandAloneRunnerSupport;
35 using StandAloneTests;
37 using NUnit.Framework;
39 namespace StandAloneTests.GridViewSortingStyles
41 [TestCase ("GridViewSortingStyles 01", "GridView supports separate styles for headers/cells when sorting.")]
42 public sealed class Test_01 : ITestCase
44 public string PhysicalPath {
45 get { return Path.Combine (Consts.BasePhysicalDir, "GridViewSortingStyles"); }
48 public string VirtualPath {
52 public bool SetUp (List <TestRunItem> runItems)
54 runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx));
55 runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx_Ascending_ProductName) {
56 PostValues = new string[] {
57 "__EVENTTARGET", "GridView1",
58 "__EVENTARGUMENT", "Sort$ProductName"
60 UrlDescription = "Ascending sorting on ProductName"
63 runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx_Descending_ProductName) {
64 PostValues = new string[] {
65 "__EVENTTARGET", "GridView1",
66 "__EVENTARGUMENT", "Sort$ProductName"
68 UrlDescription = "Descending sorting on ProductName"
71 runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx_Ascending_ProductID) {
72 PostValues = new string[] {
73 "__EVENTTARGET", "GridView1",
74 "__EVENTARGUMENT", "Sort$ProductID"
76 UrlDescription = "Ascending sorting on ProductID"
79 runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx_Descending_ProductID) {
80 PostValues = new string[] {
81 "__EVENTTARGET", "GridView1",
82 "__EVENTARGUMENT", "Sort$ProductID"
84 UrlDescription = "Descending sorting on ProductID"
90 void Default_Aspx (string result, TestRunItem runItem)
92 string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"GridView1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\"><a href=\"javascript:__doPostBack('GridView1','Sort$ProductName')\">Name</a></th><th scope=\"col\"><a href=\"javascript:__doPostBack('GridView1','Sort$ProductID')\">ID</a></th>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Pear</td><td>1</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Apple</td><td>2</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Orange</td><td>3</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
93 Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
96 void Default_Aspx_Ascending_ProductName (string result, TestRunItem runItem)
98 string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"GridView1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\" style=\"background-color:Yellow;\"><a href=\"javascript:__doPostBack('GridView1','Sort$ProductName')\">Name</a></th><th scope=\"col\"><a href=\"javascript:__doPostBack('GridView1','Sort$ProductID')\">ID</a></th>\r\n\t\t</tr><tr>\r\n\t\t\t<td style=\"background-color:LightYellow;\">Apple</td><td>2</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td style=\"background-color:LightYellow;\">Orange</td><td>3</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td style=\"background-color:LightYellow;\">Pear</td><td>1</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
99 Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
102 void Default_Aspx_Descending_ProductName (string result, TestRunItem runItem)
104 string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"GridView1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\" style=\"background-color:LightBlue;\"><a href=\"javascript:__doPostBack('GridView1','Sort$ProductName')\">Name</a></th><th scope=\"col\"><a href=\"javascript:__doPostBack('GridView1','Sort$ProductID')\">ID</a></th>\r\n\t\t</tr><tr>\r\n\t\t\t<td style=\"background-color:AliceBlue;\">Pear</td><td>1</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td style=\"background-color:AliceBlue;\">Orange</td><td>3</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td style=\"background-color:AliceBlue;\">Apple</td><td>2</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
105 Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
108 void Default_Aspx_Ascending_ProductID (string result, TestRunItem runItem)
110 string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"GridView1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\"><a href=\"javascript:__doPostBack('GridView1','Sort$ProductName')\">Name</a></th><th scope=\"col\" style=\"background-color:Yellow;\"><a href=\"javascript:__doPostBack('GridView1','Sort$ProductID')\">ID</a></th>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Pear</td><td style=\"background-color:LightYellow;\">1</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Apple</td><td style=\"background-color:LightYellow;\">2</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Orange</td><td style=\"background-color:LightYellow;\">3</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
111 Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
114 void Default_Aspx_Descending_ProductID (string result, TestRunItem runItem)
116 string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"GridView1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\"><a href=\"javascript:__doPostBack('GridView1','Sort$ProductName')\">Name</a></th><th scope=\"col\" style=\"background-color:LightBlue;\"><a href=\"javascript:__doPostBack('GridView1','Sort$ProductID')\">ID</a></th>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Orange</td><td style=\"background-color:AliceBlue;\">3</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Apple</td><td style=\"background-color:AliceBlue;\">2</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Pear</td><td style=\"background-color:AliceBlue;\">1</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
117 Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");