2 // Autogen RepeatInfoTest.auto.cs
5 // Ben Maurer <bmaurer@novell.com>
6 // Marek Habersack <mhabersack@novell.com>
8 // Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.Web.UI.WebControls;
37 using MonoTests.Helpers;
40 static string GetLayoutName (RepeatLayout layout)
43 case RepeatLayout.Flow:
46 case RepeatLayout.Table:
49 case RepeatLayout.OrderedList:
52 case RepeatLayout.UnorderedList:
56 throw new InvalidOperationException ("Unsupported layout value: " + layout);
63 Console.WriteLine ("#if NET_4_0");
65 Console.WriteLine ("#if NET_2_0 && !NET_4_0");
67 bool isMono = Type.GetType ("Mono.Runtime", false) != null;
70 // THIS IS AUTOGENERATED DO NOT EDIT
72 // Generated on {0} runtime v{1}
75 // Ben Maurer (bmaurer@novell.com)
77 // Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
79 // Permission is hereby granted, free of charge, to any person obtaining
80 // a copy of this software and associated documentation files (the
81 // ""Software""), to deal in the Software without restriction, including
82 // without limitation the rights to use, copy, modify, merge, publish,
83 // distribute, sublicense, and/or sell copies of the Software, and to
84 // permit persons to whom the Software is furnished to do so, subject to
85 // the following conditions:
87 // The above copyright notice and this permission notice shall be
88 // included in all copies or substantial portions of the Software.
90 // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
91 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
92 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
93 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
94 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
95 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
96 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
100 using System.Collections;
101 using System.ComponentModel;
102 using System.Drawing;
106 using System.Web.UI.WebControls;
108 using NUnit.Framework;
109 using MonoTests.Helpers;
111 namespace MonoTests.System.Web.UI.WebControls {{
113 public class RepeatInfo_Autogen {{
114 ", isMono ? "Mono" : "Microsoft .NET", Environment.Version);
136 bool oti, hdr, ftr, sep;
137 StringBuilder sb = new StringBuilder ();
139 for (int i = 0; i < ntests; i ++) {
140 d = (RepeatDirection) (i & (1 << 0));
144 l = (RepeatLayout) (lcount % 4);
146 l = (RepeatLayout) ((i & (1 << 1)) >> 1);
148 oti = (i & (1 << 3)) == 0;
149 hdr = (i & (1 << 4)) == 0;
150 ftr = (i & (1 << 5)) == 0;
151 sep = (i & (1 << 6)) == 0;
153 foreach (int [] col_cnt in combos) {
154 string nm = String.Format ("RepeatInfo_{0}cols_{1}itms_{2}_{3}{4}{5}{6}{7}",
157 d == RepeatDirection.Vertical ? "vert" : "horiz",
159 oti ? "_otrtblimp" : String.Empty,
160 hdr ? "_hdr" : String.Empty,
161 ftr ? "_ftr" : String.Empty,
162 sep ? "_sep" : String.Empty);
169 // RepeatDirection : {3}
170 // RepeatLayout : {4}
171 // OuterTableImplied : {5}
187 string exp = RepeatInfoUser.DoTest (col_cnt [0], col_cnt [1], d, l, oti, hdr, ftr, sep).Replace (@"""", @"""""");
188 BuildTestCode (sb, null, col_cnt [0], col_cnt [1], d, l, oti, hdr, ftr, sep, exp, num++);
189 } catch (Exception ex) {
190 BuildTestCode (sb, ex, col_cnt [0], col_cnt [1], d, l, oti, hdr, ftr, sep, null, num++);
192 Console.WriteLine (sb.ToString ());
195 Console.WriteLine (@"
201 static void BuildTestCode (StringBuilder sb, Exception ex, int cols, int cnt, RepeatDirection d, RepeatLayout l, bool oti, bool hdr, bool ftr, bool sep, string exp, int num)
204 sb.Insert (0, "\t[Test]");
206 sb.Insert (0, String.Format ("\t[ExpectedException (typeof (global::{0}))]", ex.GetType ().FullName));
207 sb.Insert (0, "\t[Test]\n");
211 string v = global::MonoTests.Helpers.RepeatInfoUser.DoTest ({0}, {1}, RepeatDirection.{2}, RepeatLayout.{3}, {4}, {5}, {6}, {7});
217 oti ? "true" : "false",
218 hdr ? "true" : "false",
219 ftr ? "true" : "false",
220 sep ? "true" : "false");
222 sb.AppendFormat (@" string exp = @""{0}"";
223 Assert.AreEqual (exp, v, ""#{1}"");
228 // Exception: {0} (""{1}"")
230 ", ex.GetType ().FullName, ex.Message);