Example #1
0
        public static void LoginExercise(string[] args)
        {
            LoginContext ctx   = new LoginContext();
            NewLogin     login = new NewLogin(ctx);

            ctx.Init(login);

            ctx.pressedLogin("123");
            // failed
            ctx.pressedLogin("1234");
            // failed
            ctx.pressedLogin("12345");
            // now succeed
            ctx.pressedLogin("4444");
            // do nothing
            ctx.pressedRestart();
            // Restart to new login now we should have 3 tries again.
            ctx.pressedLogin("123");
            // failed
            ctx.pressedLogin("1234");
            // failed
            ctx.pressedLogin("123");
            // failed
            ctx.pressedLogin("1234");
            // Locked
            ctx.pressedRestart();
            // Restart
            ctx.pressedLogin("123");
            // Failed
            ctx.pressedRestart();
            // Restart
        }
Example #2
0
 protected LoginBase(LoginContext ctx)
 {
     this.ctx = ctx;
 }
Example #3
0
 public LoginSucceed(LoginContext ctx) : base(ctx)
 {
 }
Example #4
0
 public NewLogin(LoginContext ctx) : base(ctx)
 {
 }
Example #5
0
 public LoginFailed(LoginContext ctx) : base(ctx)
 {
     counter = 1;
 }
Example #6
0
 public Locked(LoginContext ctx) : base(ctx)
 {
 }