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:
48 case RepeatLayout.OrderedList:
51 case RepeatLayout.UnorderedList:
54 throw new InvalidOperationException ("Unsupported layout value: " + layout);
60 Console.WriteLine ("#if NET_4_0");
61 bool isMono = Type.GetType ("Mono.Runtime", false) != null;
64 // THIS IS AUTOGENERATED DO NOT EDIT
66 // Generated on {0} runtime v{1}
69 // Ben Maurer (bmaurer@novell.com)
71 // Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
73 // Permission is hereby granted, free of charge, to any person obtaining
74 // a copy of this software and associated documentation files (the
75 // ""Software""), to deal in the Software without restriction, including
76 // without limitation the rights to use, copy, modify, merge, publish,
77 // distribute, sublicense, and/or sell copies of the Software, and to
78 // permit persons to whom the Software is furnished to do so, subject to
79 // the following conditions:
81 // The above copyright notice and this permission notice shall be
82 // included in all copies or substantial portions of the Software.
84 // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
85 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
86 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
87 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
88 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
89 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
90 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
94 using System.Collections;
95 using System.ComponentModel;
100 using System.Web.UI.WebControls;
102 using NUnit.Framework;
103 using MonoTests.Helpers;
105 namespace MonoTests.System.Web.UI.WebControls {{
107 public class RepeatInfo_Autogen {{
108 ", isMono ? "Mono" : "Microsoft .NET", Environment.Version);
126 bool oti, hdr, ftr, sep;
127 StringBuilder sb = new StringBuilder ();
129 for (int i = 0; i < ntests; i ++) {
130 d = (RepeatDirection) (i & (1 << 0));
133 l = (RepeatLayout) (lcount % 4);
134 oti = (i & (1 << 3)) == 0;
135 hdr = (i & (1 << 4)) == 0;
136 ftr = (i & (1 << 5)) == 0;
137 sep = (i & (1 << 6)) == 0;
139 foreach (int [] col_cnt in combos) {
140 string nm = String.Format ("RepeatInfo_{0}cols_{1}itms_{2}_{3}{4}{5}{6}{7}",
143 d == RepeatDirection.Vertical ? "vert" : "horiz",
145 oti ? "_otrtblimp" : String.Empty,
146 hdr ? "_hdr" : String.Empty,
147 ftr ? "_ftr" : String.Empty,
148 sep ? "_sep" : String.Empty);
155 // RepeatDirection : {3}
156 // RepeatLayout : {4}
157 // OuterTableImplied : {5}
173 string exp = RepeatInfoUser.DoTest (col_cnt [0], col_cnt [1], d, l, oti, hdr, ftr, sep).Replace (@"""", @"""""");
174 BuildTestCode (sb, null, col_cnt [0], col_cnt [1], d, l, oti, hdr, ftr, sep, exp, num++);
175 } catch (Exception ex) {
176 BuildTestCode (sb, ex, col_cnt [0], col_cnt [1], d, l, oti, hdr, ftr, sep, null, num++);
178 Console.WriteLine (sb.ToString ());
181 Console.WriteLine (@"
187 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)
190 sb.Insert (0, "\t[Test]");
192 sb.Insert (0, String.Format ("\t[ExpectedException (typeof (global::{0}))]", ex.GetType ().FullName));
193 sb.Insert (0, "\t[Test]\n");
197 string v = global::MonoTests.Helpers.RepeatInfoUser.DoTest ({0}, {1}, RepeatDirection.{2}, RepeatLayout.{3}, {4}, {5}, {6}, {7});
203 oti ? "true" : "false",
204 hdr ? "true" : "false",
205 ftr ? "true" : "false",
206 sep ? "true" : "false");
208 sb.AppendFormat (@" string exp = @""{0}"";
209 Assert.AreEqual (exp, v, ""#{1}"");
214 // Exception: {0} (""{1}"")
216 ", ex.GetType ().FullName, ex.Message);