Example #1
0
        public void LayoutTemplate()
        {
            TestLogin l = new TestLogin();

            l.LayoutTemplate = new LayoutTemplate();
            l.DoEnsureChildControls();
            Assert.IsNotNull(l.FindControl("Template"), "LoginTemplate");
            Assert.IsNotNull(l.FindControl("UserName"), "UserName");
        }
Example #2
0
        public static void _OnBubbleEvent_Authenticated_OnAuthenticate(Page p)
        {
            TestLogin l = new TestLogin();

            l.Page = p;
            l.Page.Validate();
            Button b = (Button)l.FindControl("LoginButton");

            Assert.IsNotNull(b, "LoginButton");
            CommandEventArgs cea = new CommandEventArgs("Login", null);

            l.UserName           = "******";
            l.Authenticated      = true;
            l.MembershipProvider = "FakeProvider";
            l.Authenticate      += new AuthenticateEventHandler(l_Authenticate);
            try {
                l.DoBubbleEvent(b, cea);
            }
            catch (NullReferenceException) {
                // ms
            }
            catch (HttpException) {
                // no context is available
            }
        }
Example #3
0
        public void OnBubbleEvent_Cancel_OnLoggingIn()
        {
            TestLogin l = new TestLogin();

            l.Page = new Page();
            l.Page.Validate();
            Button b = (Button)l.FindControl("LoginButton");

            Assert.IsNotNull(b, "LoginButton");
            CommandEventArgs cea = new CommandEventArgs("Login", null);

            l.Cancel = true;
            l.DoBubbleEvent(b, cea);
            Assert.IsTrue(l.OnLoggingInCalled, "OnLoggingIn");
            Assert.IsFalse(l.OnAuthenticateCalled, "OnAuthenticate");
            Assert.IsFalse(l.OnLoginErrorCalled, "OnLoginError");
            Assert.IsFalse(l.OnLoggedInCalled, "OnLoggedIn");
        }
Example #4
0
        public static void DoOnBubbleEvent(Page p, string cmdname)
        {
            TestLogin l = new TestLogin();

            l.Page = p;
            l.Page.Validate();
            l.MembershipProvider = "FakeProvider";
            Button b = (Button)l.FindControl("LoginButton");

            Assert.IsNotNull(b, "LoginButton");
            CommandEventArgs cea = new CommandEventArgs(cmdname, null);

            l.DoBubbleEvent(b, cea);
            Assert.IsTrue(l.OnLoggingInCalled, "OnLoggingIn");
            Assert.IsFalse(l.Cancel, "Cancel");
            Assert.IsTrue(l.OnAuthenticateCalled, "OnAuthenticate");
            Assert.IsFalse(l.Authenticated, "Authenticated");
            Assert.IsTrue(l.OnLoginErrorCalled, "OnLoginError");
            Assert.IsFalse(l.OnLoggedInCalled, "OnLoggedIn");
        }
		public static void _OnBubbleEvent_Authenticated_OnAuthenticate (Page p)
		{
			TestLogin l = new TestLogin ();
			l.Page = p;
			l.Page.Validate ();
			Button b = (Button) l.FindControl ("LoginButton");
			Assert.IsNotNull (b, "LoginButton");
			CommandEventArgs cea = new CommandEventArgs ("Login", null);
			l.UserName = "******";
			l.Authenticated = true;
			l.MembershipProvider = "FakeProvider";
			l.Authenticate += new AuthenticateEventHandler(l_Authenticate);
			try {
				l.DoBubbleEvent (b, cea);
			}
			catch (NullReferenceException) {
				// ms
			}
			catch (HttpException) {
				// no context is available
			}
		}
		public void OnBubbleEvent_Cancel_OnLoggingIn ()
		{
			TestLogin l = new TestLogin ();
			l.Page = new Page ();
			l.Page.Validate ();
			Button b = (Button)l.FindControl ("LoginButton");
			Assert.IsNotNull (b, "LoginButton");
			CommandEventArgs cea = new CommandEventArgs ("Login", null);
			l.Cancel = true;
			l.DoBubbleEvent (b, cea);
			Assert.IsTrue (l.OnLoggingInCalled, "OnLoggingIn");
			Assert.IsFalse (l.OnAuthenticateCalled, "OnAuthenticate");
			Assert.IsFalse (l.OnLoginErrorCalled, "OnLoginError");
			Assert.IsFalse (l.OnLoggedInCalled, "OnLoggedIn");
		}
		public static void DoOnBubbleEvent(Page p, string cmdname)
		{
			TestLogin l = new TestLogin ();
			l.Page = p;
			l.Page.Validate ();
			l.MembershipProvider = "FakeProvider";
			Button b = (Button)l.FindControl ("LoginButton");
			Assert.IsNotNull (b, "LoginButton");
			CommandEventArgs cea = new CommandEventArgs (cmdname, null);
			l.DoBubbleEvent (b, cea);
			Assert.IsTrue (l.OnLoggingInCalled, "OnLoggingIn");
			Assert.IsFalse (l.Cancel, "Cancel");
			Assert.IsTrue (l.OnAuthenticateCalled, "OnAuthenticate");
			Assert.IsFalse (l.Authenticated, "Authenticated");
			Assert.IsTrue (l.OnLoginErrorCalled, "OnLoginError");
			Assert.IsFalse (l.OnLoggedInCalled, "OnLoggedIn");
		}
 public void LayoutTemplate()
 {
     TestLogin l = new TestLogin();
     l.LayoutTemplate = new LayoutTemplate();
     l.DoEnsureChildControls();
     Assert.IsNotNull(l.FindControl("Template"), "LoginTemplate");
     Assert.IsNotNull(l.FindControl("UserName"), "UserName");
 }