merge r67228-r67235, r67237, r67251 and r67256-67259 to trunk (they are
[mono.git] / mcs / class / System.Web / Test / System.Web.UI.WebControls / CreateUserWizardTest.cs
1 //
2 // WizardTest.cs - Unit tests for System.Web.UI.WebControls.Wizard
3 //
4 // Author:
5 //      Vladimir Krasnov  <vladimirk@mainsoft.com>
6 //
7 // (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
8 //
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:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 // 
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.
27 //
28
29 #if NET_2_0
30
31 using System;
32 using System.Drawing;
33 using System.Threading;
34 using System.Collections;
35 using System.IO;
36 using System.Web;
37 using System.Web.UI;
38 using System.Web.UI.WebControls;
39 using System.Web.Security;
40 using System.Text.RegularExpressions;
41 using MonoTests.SystemWeb.Framework;
42 using MonoTests.stand_alone.WebHarness;
43
44 using NUnit.Framework;
45
46 namespace MonoTests.System.Web.UI.WebControls
47 {
48
49         public class TestCreateUserWizard : CreateUserWizard
50         {
51
52                 public string Tag
53                 {
54                         get { return base.TagName; }
55                 }
56
57                 public StateBag StateBag
58                 {
59                         get { return base.ViewState; }
60                 }
61
62                 public string Render ()
63                 {
64                         StringWriter sw = new StringWriter ();
65                         sw.NewLine = "\n";
66                         HtmlTextWriter writer = new HtmlTextWriter (sw);
67                         base.Render (writer);
68                         return writer.InnerWriter.ToString ();
69                 }
70
71                 public Style GetStyle ()
72                 {
73                         return base.CreateControlStyle ();
74                 }
75
76                 public void TrackState ()
77                 {
78                         TrackViewState ();
79                 }
80
81                 public void LoadState (object state)
82                 {
83                         LoadViewState (state);
84                 }
85
86                 public object SaveState ()
87                 {
88                         return SaveViewState ();
89                 }
90
91                 public void SetDesignMode (IDictionary dic)
92                 {
93                         base.SetDesignModeState (dic);
94                 }
95
96                 private bool onBubble;
97
98                 public bool OnBubbleEventCalled
99                 {
100                         get { return onBubble; }
101                         set { onBubble = value; }
102                 }
103
104                 protected override bool OnBubbleEvent (object source, EventArgs e)
105                 {
106                         onBubble = true;
107                         return base.OnBubbleEvent (source, e);
108                 }
109
110                 public bool DoBubbleEvent (object source, EventArgs e)
111                 {
112                         return base.OnBubbleEvent (source, e);
113                 }
114
115                 public void DoEnsureChildControls ()
116                 {
117                         base.EnsureChildControls ();
118                 }
119
120                 public bool DoOnBubbleEvent (EventArgs e)
121                 {
122                         return base.OnBubbleEvent (this, e);
123                 }
124         }
125
126         [Serializable]
127         [TestFixture]
128         public class CreateUserWizardTest
129         {
130                 [SetUp]
131                 public void TestSetup ()
132                 {
133                         Thread.Sleep (150);
134                 }
135
136                 [Test]
137                 public void DefaultProperties ()
138                 {
139                         TestCreateUserWizard w = new TestCreateUserWizard ();
140                         Assert.AreEqual (0, w.Attributes.Count, "Attributes.Count");
141                         Assert.AreEqual (0, w.StateBag.Count, "ViewState.Count");
142
143                         Assert.AreEqual ("Security Answer:", w.AnswerLabelText, "AnswerLabelText");
144                         Assert.AreEqual ("Security answer is required.", w.AnswerRequiredErrorMessage, "AnswerRequiredErrorMessage");
145                         Assert.IsFalse (w.AutoGeneratePassword, "AutoGeneratePassword");
146                         Assert.AreEqual ("Your account has been successfully created.", w.CompleteSuccessText, "CompleteSuccessText");
147                         Assert.AreEqual ("The Password and Confirmation Password must match.", w.ConfirmPasswordCompareErrorMessage, "ConfirmPasswordCompareErrorMessage");
148                         Assert.AreEqual ("Confirm Password:", w.ConfirmPasswordLabelText, "ConfirmPasswordLabelText");
149                         Assert.AreEqual ("Confirm Password is required.", w.ConfirmPasswordRequiredErrorMessage, "ConfirmPasswordRequiredErrorMessage");
150                         Assert.AreEqual (string.Empty, w.ContinueButtonImageUrl, "ContinueButtonImageUrl");
151                         Assert.AreEqual ("Continue", w.ContinueButtonText, "ContinueButtonText");
152                         Assert.AreEqual (ButtonType.Button, w.ContinueButtonType, "ContinueButtonType");
153                         Assert.AreEqual (string.Empty, w.ContinueDestinationPageUrl, "ContinueDestinationPageUrl");
154                         Assert.AreEqual (string.Empty, w.CreateUserButtonImageUrl, "CreateUserButtonImageUrl");
155                         Assert.AreEqual ("Create User", w.CreateUserButtonText, "CreateUserButtonText");
156                         Assert.AreEqual (ButtonType.Button, w.CreateUserButtonType, "CreateUserButtonType");
157                         Assert.IsFalse (w.DisableCreatedUser, "DisableCreatedUser");
158                         Assert.AreEqual ("The e-mail address that you entered is already in use. Please enter a different e-mail address.", w.DuplicateEmailErrorMessage, "DuplicateEmailErrorMessage");
159                         Assert.AreEqual ("Please enter a different user name.", w.DuplicateUserNameErrorMessage, "DuplicateUserNameErrorMessage");
160                         Assert.AreEqual (string.Empty, w.EditProfileIconUrl, "EditProfileIconUrl");
161                         Assert.AreEqual (string.Empty, w.EditProfileText, "EditProfileText");
162                         Assert.AreEqual (string.Empty, w.EditProfileUrl, "EditProfileUrl");
163                         Assert.AreEqual ("E-mail:", w.EmailLabelText, "EmailLabelText");
164                         Assert.AreEqual (string.Empty, w.EmailRegularExpression, "EmailRegularExpression");
165                         Assert.AreEqual ("Please enter a different e-mail.", w.EmailRegularExpressionErrorMessage, "EmailRegularExpressionErrorMessage");
166                         Assert.AreEqual ("E-mail is required.", w.EmailRequiredErrorMessage, "EmailRequiredErrorMessage");
167                         Assert.AreEqual (string.Empty, w.HelpPageIconUrl, "HelpPageIconUrl");
168                         Assert.AreEqual (string.Empty, w.HelpPageText, "HelpPageText");
169                         Assert.AreEqual (string.Empty, w.HelpPageUrl, "HelpPageUrl");
170                         Assert.AreEqual (string.Empty, w.InstructionText, "InstructionText");
171                         Assert.AreEqual ("Please enter a different security answer.", w.InvalidAnswerErrorMessage, "InvalidAnswerErrorMessage");
172                         Assert.AreEqual ("Please enter a valid e-mail address.", w.InvalidEmailErrorMessage, "InvalidEmailErrorMessage");
173                         Assert.AreEqual ("Password length minimum: {0}. Non-alphanumeric characters required: {1}.", w.InvalidPasswordErrorMessage, "InvalidPasswordErrorMessage");
174                         Assert.AreEqual ("Please enter a different security question.", w.InvalidQuestionErrorMessage, "InvalidQuestionErrorMessage");
175                         Assert.IsTrue (w.LoginCreatedUser, "LoginCreatedUser");
176                         Assert.AreEqual (string.Empty, w.MembershipProvider, "MembershipProvider");
177                         Assert.AreEqual (string.Empty, w.PasswordHintText, "PasswordHintText");
178                         Assert.AreEqual ("Password:", w.PasswordLabelText, "PasswordLabelText");
179                         Assert.AreEqual (string.Empty, w.PasswordRegularExpression, "PasswordRegularExpression");
180                         Assert.AreEqual ("Please enter a different password.", w.PasswordRegularExpressionErrorMessage, "PasswordRegularExpressionErrorMessage");
181                         Assert.AreEqual ("Password is required.", w.PasswordRequiredErrorMessage, "PasswordRequiredErrorMessage");
182                         Assert.AreEqual ("Security Question:", w.QuestionLabelText, "QuestionLabelText");
183                         Assert.AreEqual ("Security question is required.", w.QuestionRequiredErrorMessage, "QuestionRequiredErrorMessage");
184                         Assert.IsTrue (w.RequireEmail, "RequireEmail");
185                         Assert.AreEqual ("Your account was not created. Please try again.", w.UnknownErrorMessage, "UnknownErrorMessage");
186                         Assert.AreEqual ("User Name:", w.UserNameLabelText, "UserNameLabelText");
187                         Assert.AreEqual ("User Name is required.", w.UserNameRequiredErrorMessage, "UserNameRequiredErrorMessage");
188                         Assert.IsNotNull (w.WizardSteps, "WizardSteps");
189                 }
190
191                 [Test]
192                 public void AssignToDefaultProperties ()
193                 {
194                         TestCreateUserWizard w = new TestCreateUserWizard ();
195                         Assert.AreEqual (0, w.Attributes.Count, "Attributes.Count");
196                         Assert.AreEqual (0, w.StateBag.Count, "ViewState.Count");
197
198                         int count = 0;
199
200                         w.AnswerLabelText = "value";
201                         Assert.AreEqual ("value", w.AnswerLabelText, "CancelButtonImageUrl");
202                         Assert.AreEqual (++count, w.StateBag.Count, "ViewState.Count-1");
203
204                         w.AutoGeneratePassword = true;
205                         Assert.AreEqual (true, w.AutoGeneratePassword, "Assign AutoGeneratePassword");
206                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate AutoGeneratePassword");
207
208                         w.CompleteSuccessText = "text";
209                         Assert.AreEqual ("text", w.CompleteSuccessText, "Assign CompleteSuccessText");
210                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate CompleteSuccessText");
211
212                         w.ConfirmPasswordCompareErrorMessage = "text";
213                         Assert.AreEqual ("text", w.ConfirmPasswordCompareErrorMessage, "Assign ConfirmPasswordCompareErrorMessage,");
214                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate ConfirmPasswordCompareErrorMessage,");
215
216                         w.ConfirmPasswordLabelText = "text";
217                         Assert.AreEqual ("text", w.ConfirmPasswordLabelText, "Assign ConfirmPasswordLabelText");
218                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate ConfirmPasswordLabelText");
219
220                         w.ConfirmPasswordRequiredErrorMessage = "text";
221                         Assert.AreEqual ("text", w.ConfirmPasswordRequiredErrorMessage, "Assign ConfirmPasswordRequiredErrorMessage");
222                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate ConfirmPasswordRequiredErrorMessage");
223
224                         w.ContinueButtonImageUrl = "text";
225                         Assert.AreEqual ("text", w.ContinueButtonImageUrl, "Assign ContinueButtonImageUrl");
226                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate ContinueButtonImageUrl");
227
228                         w.ContinueButtonText = "text";
229                         Assert.AreEqual ("text", w.ContinueButtonText, "Assign ContinueButtonText");
230                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate ContinueButtonText");
231
232                         //w.ContinueButtonType = ButtonType.Button;
233                         //Assert.AreEqual(ButtonType.Button, w.ContinueButtonType, "Assign ContinueButtonType");
234                         //Assert.AreEqual(count, w.StateBag.Count, "Viewstate ContinueButtonType");
235
236                         w.ContinueDestinationPageUrl = "text";
237                         Assert.AreEqual ("text", w.ContinueDestinationPageUrl, "Assign ContinueDestinationPageUrl");
238                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate ContinueDestinationPageUrl");
239
240                         w.CreateUserButtonImageUrl = "text";
241                         Assert.AreEqual ("text", w.CreateUserButtonImageUrl, "Assign CreateUserButtonImageUrl");
242                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate CreateUserButtonImageUrl");
243
244                         w.CreateUserButtonText = "text";
245                         Assert.AreEqual ("text", w.CreateUserButtonText, "Assign CreateUserButtonText");
246                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate CreateUserButtonText");
247
248                         //w.CreateUserButtonType = ButtonType.Button;
249                         //Assert.AreEqual(ButtonType.Button, w.CreateUserButtonType, "Assign CreateUserButtonType");
250                         //Assert.AreEqual(count, w.StateBag.Count, "Viewstate CreateUserButtonType");
251
252                         w.DisableCreatedUser = false;
253                         Assert.AreEqual (false, w.DisableCreatedUser, "Assign DisableCreatedUser");
254                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate DisableCreatedUser");
255
256                         w.DuplicateEmailErrorMessage = "msg";
257                         Assert.AreEqual ("msg", w.DuplicateEmailErrorMessage, "Assign DuplicateEmailErrorMessage");
258                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate DuplicateEmailErrorMessage");
259
260                         w.DuplicateUserNameErrorMessage = "msg";
261                         Assert.AreEqual ("msg", w.DuplicateUserNameErrorMessage, "Assign DuplicateUserNameErrorMessage");
262                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate DuplicateUserNameErrorMessage");
263
264                         w.EditProfileIconUrl = "msg";
265                         Assert.AreEqual ("msg", w.EditProfileIconUrl, "Assign EditProfileIconUrl");
266                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate EditProfileIconUrl");
267
268                         w.EditProfileText = "msg";
269                         Assert.AreEqual ("msg", w.EditProfileText, "Assign EditProfileText");
270                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate EditProfileText");
271
272                         w.EditProfileUrl = "msg";
273                         Assert.AreEqual ("msg", w.EditProfileUrl, "Assign EditProfileUrl");
274                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate EditProfileUrl");
275
276                         w.EmailLabelText = "msg";
277                         Assert.AreEqual ("msg", w.EmailLabelText, "Assign EmailLabelText");
278                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate EmailLabelText");
279
280                         w.EmailRegularExpression = "msg";
281                         Assert.AreEqual ("msg", w.EmailRegularExpression, "Assign EmailRegularExpression");
282                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate EmailRegularExpression");
283
284                         w.EmailRegularExpressionErrorMessage = "msg";
285                         Assert.AreEqual ("msg", w.EmailRegularExpressionErrorMessage, "Assign EmailRegularExpressionErrorMessage");
286                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate EmailRegularExpressionErrorMessage");
287
288                         w.EmailRequiredErrorMessage = "msg";
289                         Assert.AreEqual ("msg", w.EmailRequiredErrorMessage, "Assign EmailRequiredErrorMessage");
290                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate EmailRequiredErrorMessage");
291
292                         w.HelpPageIconUrl = "msg";
293                         Assert.AreEqual ("msg", w.HelpPageIconUrl, "Assign HelpPageIconUrl");
294                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate HelpPageIconUrl");
295
296                         w.HelpPageText = "msg";
297                         Assert.AreEqual ("msg", w.HelpPageText, "Assign HelpPageText");
298                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate HelpPageText");
299
300                         w.HelpPageUrl = "msg";
301                         Assert.AreEqual ("msg", w.HelpPageUrl, "Assign HelpPageUrl");
302                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate HelpPageUrl");
303
304                         w.InstructionText = "msg";
305                         Assert.AreEqual ("msg", w.InstructionText, "Assign InstructionText");
306                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate InstructionText");
307
308                         w.InvalidAnswerErrorMessage = "msg";
309                         Assert.AreEqual ("msg", w.InvalidAnswerErrorMessage, "Assign InvalidAnswerErrorMessage");
310                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate InvalidAnswerErrorMessage");
311
312                         w.InvalidEmailErrorMessage = "msg";
313                         Assert.AreEqual ("msg", w.InvalidEmailErrorMessage, "Assign InvalidEmailErrorMessage");
314                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate InvalidEmailErrorMessage");
315
316                         w.InvalidPasswordErrorMessage = "msg";
317                         Assert.AreEqual ("msg", w.InvalidPasswordErrorMessage, "Assign InvalidPasswordErrorMessage");
318                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate InvalidPasswordErrorMessage");
319
320                         w.InvalidQuestionErrorMessage = "msg";
321                         Assert.AreEqual ("msg", w.InvalidQuestionErrorMessage, "Assign InvalidQuestionErrorMessage");
322                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate InvalidQuestionErrorMessage");
323
324                         w.LoginCreatedUser = false;
325                         Assert.AreEqual (false, w.LoginCreatedUser, "Assign LoginCreatedUser");
326                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate LoginCreatedUser");
327
328                         w.MembershipProvider = "msg";
329                         Assert.AreEqual ("msg", w.MembershipProvider, "Assign MembershipProvider");
330                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate MembershipProvider");
331
332                         w.PasswordHintText = "msg";
333                         Assert.AreEqual ("msg", w.PasswordHintText, "Assign PasswordHintText");
334                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate PasswordHintText");
335
336                         w.PasswordLabelText = "msg";
337                         Assert.AreEqual ("msg", w.PasswordLabelText, "Assign PasswordLabelText");
338                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate PasswordLabelText");
339
340                         w.PasswordRegularExpression = "msg";
341                         Assert.AreEqual ("msg", w.PasswordRegularExpression, "Assign PasswordRegularExpression");
342                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate PasswordRegularExpression");
343
344                         w.PasswordRegularExpressionErrorMessage = "msg";
345                         Assert.AreEqual ("msg", w.PasswordRegularExpressionErrorMessage, "Assign PasswordRegularExpressionErrorMessage");
346                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate PasswordRegularExpressionErrorMessage");
347
348                         w.PasswordRequiredErrorMessage = "msg";
349                         Assert.AreEqual ("msg", w.PasswordRequiredErrorMessage, "Assign PasswordRequiredErrorMessage");
350                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate PasswordRequiredErrorMessage");
351
352                         w.QuestionLabelText = "msg";
353                         Assert.AreEqual ("msg", w.QuestionLabelText, "Assign QuestionLabelText");
354                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate QuestionLabelText");
355
356                         w.QuestionRequiredErrorMessage = "msg";
357                         Assert.AreEqual ("msg", w.QuestionRequiredErrorMessage, "Assign QuestionRequiredErrorMessage");
358                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate QuestionRequiredErrorMessage");
359
360                         w.RequireEmail = false;
361                         Assert.AreEqual (false, w.RequireEmail, "Assign RequireEmail");
362                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate RequireEmail");
363
364                         w.UnknownErrorMessage = "msg";
365                         Assert.AreEqual ("msg", w.UnknownErrorMessage, "Assign UnknownErrorMessage");
366                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate UnknownErrorMessage");
367
368                         w.UserNameLabelText = "msg";
369                         Assert.AreEqual ("msg", w.UserNameLabelText, "Assign UserNameLabelText");
370                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate UserNameLabelText");
371
372                         w.UserNameRequiredErrorMessage = "msg";
373                         Assert.AreEqual ("msg", w.UserNameRequiredErrorMessage, "Assign UserNameRequiredErrorMessage");
374                         Assert.AreEqual (++count, w.StateBag.Count, "Viewstate UserNameRequiredErrorMessage");
375
376
377
378                 }
379
380                 public static void BasicRenderTestInit (Page p)
381                 {
382                         CreateTestControl (p);
383                 }
384
385                 public static CreateUserWizard CreateTestControl (Page p)
386                 {
387                         LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
388                         LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
389
390                         CreateUserWizard w = new CreateUserWizard ();
391                         w.ID = "CreateUserWizard1";
392
393                         CreateUserWizardStep step1 = new CreateUserWizardStep ();
394                         CompleteWizardStep step2 = new CompleteWizardStep ();
395
396                         w.MembershipProvider = "FakeProvider";
397                         w.WizardSteps.Add (step1);
398                         w.WizardSteps.Add (step2);
399
400                         p.Form.Controls.Add (lcb);
401                         p.Form.Controls.Add (w);
402                         p.Form.Controls.Add (lce);
403
404                         //p.ClientScript.RegisterForEventValidation (w.ID);
405
406                         return w;
407                 }
408
409                 [Test]
410         [Category ("NotWorking")]
411                 [Category ("NunitWeb")]
412                 public void BasicRenderTest ()
413                 {
414                         string html = new WebTest (PageInvoker.CreateOnLoad (
415                                 new PageDelegate (BasicRenderTestInit))).Run ();
416
417                         int st = 0;
418                         Assert.IsTrue ((st = html.IndexOf ("<table", st)) > 0, "base render test 1");
419                         Assert.IsTrue ((st = html.IndexOf ("CreateUserWizard1", st)) > 0, "base render test 2");
420                         Assert.IsTrue ((st = html.IndexOf ("border-collapse:collapse", st)) > 0, "base render test 3");
421                         Assert.IsTrue ((st = html.IndexOf ("<table", st)) > 0, "base render test 4");
422                         Assert.IsTrue ((st = html.IndexOf ("height:100%", st)) > 0, "base render test 5");
423                         Assert.IsTrue ((st = html.IndexOf ("Sign Up for Your New Account", st)) > 0, "base render test 6");
424                         Assert.IsTrue ((st = html.IndexOf ("UserName", st)) > 0, "base render test 7");
425                         Assert.IsTrue ((st = html.IndexOf ("User Name:", st)) > 0, "base render test 8");
426                         Assert.IsTrue ((st = html.IndexOf ("UserName", st)) > 0, "base render test 9");
427                         Assert.IsTrue ((st = html.IndexOf ("Password", st)) > 0, "base render test 10");
428                         Assert.IsTrue ((st = html.IndexOf ("Password:", st)) > 0, "base render test 11");
429                         Assert.IsTrue ((st = html.IndexOf ("Password", st)) > 0, "base render test 12");
430                         Assert.IsTrue ((st = html.IndexOf ("ConfirmPassword", st)) > 0, "base render test 13");
431                         Assert.IsTrue ((st = html.IndexOf ("Confirm Password:", st)) > 0, "base render test 14");
432                         Assert.IsTrue ((st = html.IndexOf ("ConfirmPassword", st)) > 0, "base render test 15");
433                         Assert.IsTrue ((st = html.IndexOf ("Email", st)) > 0, "base render test 16");
434                         Assert.IsTrue ((st = html.IndexOf ("E-mail:", st)) > 0, "base render test 17");
435                         Assert.IsTrue ((st = html.IndexOf ("Email", st)) > 0, "base render test 18");
436                         Assert.IsTrue ((st = html.IndexOf ("Question", st)) > 0, "base render test 19");
437                         Assert.IsTrue ((st = html.IndexOf ("Security Question:", st)) > 0, "base render test 20");
438                         Assert.IsTrue ((st = html.IndexOf ("Question", st)) > 0, "base render test 21");
439                         Assert.IsTrue ((st = html.IndexOf ("Answer", st)) > 0, "base render test 22");
440                         Assert.IsTrue ((st = html.IndexOf ("Security Answer:", st)) > 0, "base render test 23");
441                         Assert.IsTrue ((st = html.IndexOf ("Answer", st)) > 0, "base render test 24");
442                         Assert.IsTrue ((st = html.IndexOf ("<input", st)) > 0, "base render test 25");
443                         Assert.IsTrue ((st = html.IndexOf ("submit", st)) > 0, "base render test 26");
444                         Assert.IsTrue ((st = html.IndexOf ("NextButton", st)) > 0, "base render test 27");
445                 }
446
447                 [Test]
448         [Category ("NotWorking")]
449                 [Category ("NunitWeb")]
450                 public void TitlesRenderTest ()
451                 {
452                         string html = new WebTest (PageInvoker.CreateOnLoad (
453                                 new PageDelegate (TitlesRenderTestInit))).Run ();
454
455                         Assert.IsTrue (html.IndexOf ("userid") > 0, "UserNameLabelText");
456                         Assert.IsTrue (html.IndexOf ("pincode") > 0, "PasswordLabelText");
457                         Assert.IsTrue (html.IndexOf ("cpincode") > 0, "ConfirmPasswordLabelText");
458                         Assert.IsTrue (html.IndexOf ("zzxcmnmncx") > 0, "QuestionLabelText");
459                         Assert.IsTrue (html.IndexOf ("kjkjskjkjskjkj") > 0, "AnswerLabelText");
460                         Assert.IsTrue (html.IndexOf ("emailemail") > 0, "EmailLabelText");
461                 }
462
463                 public static void TitlesRenderTestInit (Page p)
464                 {
465                         CreateUserWizard w = CreateTestControl (p);
466                         w.UserNameLabelText = "userid";
467                         w.PasswordLabelText = "pincode";
468                         w.ConfirmPasswordLabelText = "cpincode";
469                         w.QuestionLabelText = "zzxcmnmncx";
470                         w.AnswerLabelText = "kjkjskjkjskjkj";
471                         w.EmailLabelText = "emailemail";
472                 }
473
474                 [Test]
475         [Category ("NotWorking")]
476                 [Category ("NunitWeb")]
477                 public void ExtraTitlesRenderTest ()
478                 {
479                         string html = new WebTest (PageInvoker.CreateOnLoad (
480                                 new PageDelegate (ExtraTitlesRenderTestInit))).Run ();
481
482                         Assert.IsTrue (html.IndexOf ("PasswordHintText") > 0, "PasswordHintText");
483                         Assert.IsTrue (html.IndexOf ("InstructionText") > 0, "InstructionText");
484                         Assert.IsTrue (html.IndexOf ("http://www.HelpPageUrl.com") > 0, "HelpPageUrl");
485                         Assert.IsTrue (html.IndexOf ("HelpPageText") > 0, "HelpPageText");
486                         Assert.IsTrue (html.IndexOf ("http://www.HelpPageIconUrl.com") > 0, "HelpPageIconUrl");
487                         Assert.IsTrue (html.IndexOf ("CreateUserButtonText") > 0, "CreateUserButtonText");
488                         Assert.IsTrue (html.IndexOf ("CreateUserStep.Title") > 0, "CreateUserStep.Title");
489                 }
490
491                 public static void ExtraTitlesRenderTestInit (Page p)
492                 {
493                         CreateUserWizard w = CreateTestControl (p);
494                         w.PasswordHintText = "PasswordHintText";
495                         w.InstructionText = "InstructionText";
496                         w.HelpPageUrl = "http://www.HelpPageUrl.com";
497                         w.HelpPageText = "HelpPageText";
498                         w.HelpPageIconUrl = "http://www.HelpPageIconUrl.com";
499                         w.CreateUserStep.Title = "CreateUserStep.Title";
500                         w.CreateUserButtonText = "CreateUserButtonText";
501                 }
502
503                 [Test]
504         [Category ("NotWorking")]
505                 [Category ("NunitWeb")]
506                 public void StylesRenderTest ()
507                 {
508                         string html = new WebTest (PageInvoker.CreateOnLoad (
509                                 new PageDelegate (StylesRenderTestInit))).Run ();
510
511                         Assert.IsTrue (html.IndexOf ("LightGoldenrodYellow;") > 0, "TextBoxStyle");
512                         Assert.IsTrue (html.LastIndexOf ("LightGoldenrodYellow;") > html.IndexOf ("LightGoldenrodYellow;"), "TextBoxStyle2");
513                         Assert.IsTrue (html.IndexOf ("732px") > 0, "TitleTextStyle");
514                         Assert.IsTrue (html.IndexOf ("LightSkyBlue;") > 0, "HyperLinkStyle");
515                         Assert.IsTrue (html.IndexOf ("MediumSeaGreen;") > 0, "InstructionTextStyle");
516                         Assert.IsTrue (html.IndexOf ("MediumSpringGreen;") > 0, "LabelStyle");
517                         Assert.IsTrue (html.IndexOf ("MintCream;") > 0, "PasswordHintStyle");
518                         Assert.IsTrue (html.IndexOf ("PeachPuff;") > 0, "CreateUserButtonStyle");
519
520                 }
521
522                 private string GetDecoratedId (string html, string id)
523                 {
524                         Regex reg = new Regex ("name=\".*[\\$\\:]" + id + "\"");
525                         Match match = reg.Match (html);
526
527                         string fixedId = match.Value;
528                         if (fixedId.Length > 0)
529                                 fixedId = fixedId.Substring (fixedId.IndexOf ("\""), fixedId.Length - fixedId.IndexOf ("\"")).Trim ('\"');
530
531                         return fixedId;
532                 }
533
534                 private static string GetEventTarget (string html, string id)
535                 {
536                         Regex reg = new Regex ("__doPostBack.*\\(.*'.*" + id + "'");
537                         Match match = reg.Match (html);
538
539                         string fixedId = match.Value;
540                         if (fixedId.Length > 0)
541                                 fixedId = fixedId.Substring (fixedId.IndexOf ("'"), fixedId.Length - fixedId.IndexOf ("'")).Trim ('\'');
542
543                         return fixedId;
544                 }
545
546                 [Test]
547         [Category ("NotWorking")]
548                 [Category ("NunitWeb")]
549                 public void BasicPostbackTest ()
550                 {
551                         PageInvoker pi = PageInvoker.CreateOnLoad (new PageDelegate (StylesRenderTestInit));
552                         WebTest test = new WebTest (pi);
553
554                         string html = test.Run ();
555                         test.Invoker = pi;
556
557                         FormRequest fr = new FormRequest (test.Response, "form1");
558
559                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "UserName"), "username"));
560                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Password"), "password"));
561                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "ConfirmPassword"), "password"));
562                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Email"), "email"));
563                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Question"), "question"));
564                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Answer"), "answer"));
565
566                         PageDelegates pd = new PageDelegates ();
567                         pd.PreRender = new PageDelegate (BasicPostTestPreRender);
568                         pd.Load = new PageDelegate (StylesRenderTestInit);
569                         pi.Delegates = pd;
570
571                         test.Request = fr;
572                         html = test.Run ();
573
574                         Assert.IsTrue (html.IndexOf ("username") > 0, "rendered user name");
575                         Assert.IsTrue (html.IndexOf ("password") > 0, "rendered user password");
576                         Assert.IsTrue (html.IndexOf ("password") > 0, "rendered user confirm password");
577                         Assert.IsTrue (html.IndexOf ("email") > 0, "rendered user email");
578                         Assert.IsTrue (html.IndexOf ("question") > 0, "rendered user question");
579                         Assert.IsTrue (html.IndexOf ("answer") > 0, "rendered user answer");
580
581                         Assert.IsTrue (html.IndexOf ("LightGoldenrodYellow;") > 0, "TextBoxStyle");
582                         Assert.IsTrue (html.LastIndexOf ("LightGoldenrodYellow;") > html.IndexOf ("LightGoldenrodYellow;"), "TextBoxStyle2");
583                         Assert.IsTrue (html.IndexOf ("732px") > 0, "TitleTextStyle");
584                         Assert.IsTrue (html.IndexOf ("LightSkyBlue;") > 0, "HyperLinkStyle");
585                         Assert.IsTrue (html.IndexOf ("MediumSeaGreen;") > 0, "InstructionTextStyle");
586                         Assert.IsTrue (html.IndexOf ("MediumSpringGreen;") > 0, "LabelStyle");
587                         Assert.IsTrue (html.IndexOf ("MintCream;") > 0, "PasswordHintStyle");
588                         Assert.IsTrue (html.IndexOf ("PeachPuff;") > 0, "CreateUserButtonStyle");
589                 }
590
591                 public static void BasicPostTestPreRender (Page p)
592                 {
593                         CreateUserWizard w = (CreateUserWizard) p.FindControl ("CreateUserWizard1");
594                         if (w == null)
595                                 Assert.Fail ("postback1");
596
597                         Assert.AreEqual ("username", w.UserName, "posted user name");
598                         Assert.AreEqual ("password", w.Password, "posted user password");
599                         Assert.AreEqual ("password", w.ConfirmPassword, "posted user confirm password");
600                         Assert.AreEqual ("email", w.Email, "posted user email");
601                         Assert.AreEqual ("question", w.Question, "posted user question");
602                         Assert.AreEqual ("answer", w.Answer, "posted user answer");
603
604                 }
605
606                 public static void StylesRenderTestInit (Page p)
607                 {
608                         CreateUserWizard w = CreateTestControl (p);
609
610                         if (!p.IsPostBack) {
611                                 w.TextBoxStyle.BackColor = Color.LightGoldenrodYellow;
612                                 w.TitleTextStyle.Height = Unit.Pixel (732);
613                                 w.LabelStyle.BackColor = Color.MediumSpringGreen;
614
615                                 w.HelpPageUrl = "http://www.HelpPageUrl.com";
616                                 w.HelpPageText = "hhh";
617                                 w.HyperLinkStyle.BackColor = Color.LightSkyBlue;
618
619                                 w.InstructionText = "text";
620                                 w.InstructionTextStyle.BackColor = Color.MediumSeaGreen;
621
622                                 w.PasswordHintText = "pwdhint";
623                                 w.PasswordHintStyle.BackColor = Color.MintCream;
624
625                                 w.CreateUserButtonStyle.BackColor = Color.PeachPuff;
626
627                                 w.ContinueButtonType = ButtonType.Image;
628                                 w.ContinueButtonStyle.Width = Unit.Pixel (321);
629                                 w.ContinueButtonImageUrl = "http://localhost/abc.gif";
630
631                                 w.CompleteSuccessTextStyle.BackColor = Color.Violet;
632                                 w.CompleteSuccessText = "user created";
633                         }
634                 }
635
636                 // TODO:
637                 // ValidatorTextStyle
638                 // ErrorMessageStyle
639                 [Test]
640         [Category ("NotWorking")]
641                 [Category ("NunitWeb")]
642                 public void CreateUserTest ()
643                 {
644                         PageInvoker pi = PageInvoker.CreateOnLoad (new PageDelegate (StylesRenderTestInit));
645                         WebTest test = new WebTest (pi);
646
647                         string html = test.Run ();
648                         test.Invoker = pi;
649
650                         FormRequest fr = new FormRequest (test.Response, "form1");
651
652                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "UserName"), "username"));
653                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Password"), "password"));
654                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "ConfirmPassword"), "password"));
655                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Email"), "email"));
656                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Question"), "question"));
657                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Answer"), "answer"));
658                         string button = GetDecoratedId (html, "StepNextButtonButton");
659                         if (button.Length > 0)
660                                 fr.Controls.Add (new BaseControl (GetDecoratedId (html, "StepNextButtonButton"), "Create User"));
661                         else
662                                 fr.Controls.Add (new BaseControl ("__EVENTTARGET", GetEventTarget (html, "StartNextButton")));
663
664                         test.Request = fr;
665                         html = test.Run ();
666
667                         Assert.IsTrue (html.IndexOf ("Complete") > 0, "Create User");
668                         Assert.IsTrue (html.IndexOf ("type=\"image\"") > 0, "ContinueButtonType");
669                         Assert.IsTrue (html.IndexOf ("321px") > 0, "ContinueButtonStyle");
670                         Assert.IsTrue (html.IndexOf ("http://localhost/abc.gif") > 0, "ContinueButtonImageUrl");
671                         Assert.IsTrue (html.IndexOf ("Violet") > 0, "CompleteSuccessTextStyle");
672                         Assert.IsTrue (html.IndexOf ("user created") > 0, "CompleteSuccessText");
673                 }
674
675
676                 [Test]
677         [Category ("NotWorking")]
678                 [Category ("NunitWeb")]
679                 public void ButtonsRenderTest ()
680                 {
681                         string html = new WebTest (PageInvoker.CreateOnLoad (
682                                 new PageDelegate (ButtonsRenderTestInit))).Run ();
683
684                         Assert.IsTrue (html.IndexOf ("Pink;") > 0, "CreateUserButtonStyle");
685                         Assert.IsTrue (html.IndexOf ("14px") > 0, "CreateUserButtonStyle");
686                         Assert.IsTrue (html.IndexOf ("CreateUserButtonText") > 0, "CreateUserButtonText");
687                 }
688
689                 public static void ButtonsRenderTestInit (Page p)
690                 {
691                         CreateUserWizard w = CreateTestControl (p);
692                         w.CreateUserButtonStyle.BorderColor = Color.Pink;
693                         w.CreateUserButtonStyle.BorderWidth = Unit.Pixel (14);
694                         w.CreateUserButtonType = ButtonType.Link;
695                         w.CreateUserButtonText = "CreateUserButtonText";
696                 }
697
698                 [Test]
699         [Category ("NotWorking")]
700                 [Category ("NunitWeb")]
701                 public void ErrorMsgTest ()
702                 {
703                         PageInvoker pi = PageInvoker.CreateOnLoad (new PageDelegate (ErrorMsgTestInit));
704                         WebTest test = new WebTest (pi);
705
706                         string html = test.Run ();
707                         test.Invoker = pi;
708
709                         FormRequest fr = new FormRequest (test.Response, "form1");
710                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "UserName"), "duplicate"));
711                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Password"), "123"));
712                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "ConfirmPassword"), "123"));
713                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Email"), "123"));
714                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Question"), "123"));
715                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Answer"), "123"));
716                         string button = GetDecoratedId (html, "StepNextButtonButton");
717                         if (button.Length > 0)
718                                 fr.Controls.Add (new BaseControl (button, "Create User"));
719                         else
720                                 fr.Controls.Add (new BaseControl ("__EVENTTARGET", GetEventTarget (html, "StartNextButton")));
721
722                         test.Request = fr;
723                         html = test.Run ();
724
725                         Assert.IsTrue (html.IndexOf ("duplicateuser") > 0, "duplicateuser");
726
727                         test.Invoker = pi;
728                         fr = new FormRequest (test.Response, "form1");
729                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "UserName"), "incorrect"));
730                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Password"), "123"));
731                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "ConfirmPassword"), "123"));
732                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Email"), "123"));
733                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Question"), "123"));
734                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Answer"), "123"));
735                         button = GetDecoratedId (html, "StepNextButtonButton");
736                         if (button.Length > 0)
737                                 fr.Controls.Add (new BaseControl (button, "Create User"));
738                         else
739                                 fr.Controls.Add (new BaseControl ("__EVENTTARGET", GetEventTarget (html, "StartNextButton")));
740
741                         test.Request = fr;
742                         html = test.Run ();
743
744                         Assert.IsTrue (html.IndexOf ("unknown") > 0, "unknown");
745
746                         test.Invoker = pi;
747                         fr = new FormRequest (test.Response, "form1");
748                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "UserName"), "123"));
749                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Password"), "incorrect"));
750                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "ConfirmPassword"), "incorrect"));
751                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Email"), "123"));
752                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Question"), "123"));
753                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Answer"), "123"));
754                         button = GetDecoratedId (html, "StepNextButtonButton");
755                         if (button.Length > 0)
756                                 fr.Controls.Add (new BaseControl (button, "Create User"));
757                         else
758                                 fr.Controls.Add (new BaseControl ("__EVENTTARGET", GetEventTarget (html, "StartNextButton")));
759
760                         test.Request = fr;
761                         html = test.Run ();
762
763                         Assert.IsTrue (html.IndexOf ("invpwd") > 0, "invpwd");
764
765                         test.Invoker = pi;
766                         fr = new FormRequest (test.Response, "form1");
767                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "UserName"), "123"));
768                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Password"), "123"));
769                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "ConfirmPassword"), "123"));
770                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Email"), "incorrect"));
771                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Question"), "123"));
772                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Answer"), "123"));
773                         button = GetDecoratedId (html, "StepNextButtonButton");
774                         if (button.Length > 0)
775                                 fr.Controls.Add (new BaseControl (button, "Create User"));
776                         else
777                                 fr.Controls.Add (new BaseControl ("__EVENTTARGET", GetEventTarget (html, "StartNextButton")));
778
779                         test.Request = fr;
780                         html = test.Run ();
781
782                         Assert.IsTrue (html.IndexOf ("invemail") > 0, "invemail");
783
784                         test.Invoker = pi;
785                         fr = new FormRequest (test.Response, "form1");
786                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "UserName"), "123"));
787                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Password"), "123"));
788                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "ConfirmPassword"), "123"));
789                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Email"), "duplicate"));
790                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Question"), "123"));
791                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Answer"), "123"));
792                         button = GetDecoratedId (html, "StepNextButtonButton");
793                         if (button.Length > 0)
794                                 fr.Controls.Add (new BaseControl (button, "Create User"));
795                         else
796                                 fr.Controls.Add (new BaseControl ("__EVENTTARGET", GetEventTarget (html, "StartNextButton")));
797
798                         test.Request = fr;
799                         html = test.Run ();
800
801                         Assert.IsTrue (html.IndexOf ("duplicateemail") > 0, "duplicateemail");
802
803                         test.Invoker = pi;
804                         fr = new FormRequest (test.Response, "form1");
805                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "UserName"), "123"));
806                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Password"), "123"));
807                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "ConfirmPassword"), "123"));
808                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Email"), "123"));
809                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Question"), "incorrect"));
810                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Answer"), "123"));
811                         button = GetDecoratedId (html, "StepNextButtonButton");
812                         if (button.Length > 0)
813                                 fr.Controls.Add (new BaseControl (button, "Create User"));
814                         else
815                                 fr.Controls.Add (new BaseControl ("__EVENTTARGET", GetEventTarget (html, "StartNextButton")));
816
817                         test.Request = fr;
818                         html = test.Run ();
819
820                         Assert.IsTrue (html.IndexOf ("invquestion") > 0, "invquestion");
821
822                         test.Invoker = pi;
823                         fr = new FormRequest (test.Response, "form1");
824                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "UserName"), "123"));
825                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Password"), "123"));
826                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "ConfirmPassword"), "123"));
827                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Email"), "123"));
828                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Question"), "123"));
829                         fr.Controls.Add (new BaseControl (GetDecoratedId (html, "Answer"), "incorrect"));
830                         button = GetDecoratedId (html, "StepNextButtonButton");
831                         if (button.Length > 0)
832                                 fr.Controls.Add (new BaseControl (button, "Create User"));
833                         else
834                                 fr.Controls.Add (new BaseControl ("__EVENTTARGET", GetEventTarget (html, "StartNextButton")));
835
836                         test.Request = fr;
837                         html = test.Run ();
838
839                         Assert.IsTrue (html.IndexOf ("invanswer") > 0, "invanswer");
840                 }
841
842                 public static void ErrorMsgTestInit (Page p)
843                 {
844                         CreateUserWizard w = CreateTestControl (p);
845
846                         if (!p.IsPostBack) {
847                                 w.AnswerRequiredErrorMessage = "answerreq";
848                                 w.ConfirmPasswordCompareErrorMessage = "passwordconfirm";
849                                 w.ConfirmPasswordRequiredErrorMessage = "passwordconfreq";
850                                 w.DuplicateEmailErrorMessage = "duplicateemail";
851                                 w.DuplicateUserNameErrorMessage = "duplicateuser";
852                                 w.EmailRequiredErrorMessage = "emailreq";
853                                 w.InvalidAnswerErrorMessage = "invanswer";
854                                 w.InvalidEmailErrorMessage = "invemail";
855                                 w.InvalidPasswordErrorMessage = "invpwd";
856                                 w.InvalidQuestionErrorMessage = "invquestion";
857                                 w.PasswordRequiredErrorMessage = "pwdreq";
858                                 w.QuestionRequiredErrorMessage = "questreq";
859                                 w.UserNameRequiredErrorMessage = "userreq";
860                                 w.UnknownErrorMessage = "unknown";
861                         }
862                 }
863
864                 [Test]
865                 public void BibbleEvent_ContinueButtonCommand ()
866                 {
867                         TestCreateUserWizard w = new TestCreateUserWizard ();
868                         w.ContinueButtonClick += new EventHandler (w_ContinueButtonClick);
869                         w.FinishButtonClick += new WizardNavigationEventHandler (w_FinishButtonClick);
870                         _ContinueButtonClickFlag = false;
871                         _FinishButtonClickFlag = false;
872
873                         CommandEventArgs continueCommandArg = new CommandEventArgs (CreateUserWizard.ContinueButtonCommandName, null);
874                         Assert.AreEqual (true, w.DoOnBubbleEvent (continueCommandArg), "Bubble Event#1");
875                         Assert.AreEqual (true, _ContinueButtonClickFlag, "Bubble Event#2");
876                         Assert.AreEqual (false, _FinishButtonClickFlag, "Bubble Event#3");
877                 }
878
879                 bool _ContinueButtonClickFlag;
880                 bool _FinishButtonClickFlag;
881
882                 void w_ContinueButtonClick (object sender, EventArgs e)
883                 {
884                         _ContinueButtonClickFlag = true;
885                 }
886
887                 void w_FinishButtonClick (object sender, WizardNavigationEventArgs e)
888                 {
889                         _FinishButtonClickFlag = true;
890                 }
891         }
892 }
893
894 #endif