Ejemplo n.º 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");
        }
Ejemplo n.º 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
            }
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 5
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
			}
		}
Ejemplo n.º 6
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");
		}
Ejemplo n.º 7
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");
		}
Ejemplo n.º 8
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");
 }