public ValidApplicationReceived()
 {
     _registrator = new Registrator();
     var app = new Application(email:"*****@*****.**",password:"******",confirm:"password");
     _result = _registrator.ApplyForMembership(app);
     _user = _result.NewUser;
 }
Ejemplo n.º 2
0
        public PasswordDontMatch()
        {
            var app = new Application("*****@*****.**", "password", "password");
              new Registrator().ApplyForMembership(app);

              _result = new Authenticator().AuthenticateUser(new Credentials { Email = "*****@*****.**", Password = "******" });
        }
Ejemplo n.º 3
0
        public ValidEmail()
        {
            var app = new Application("*****@*****.**", "password", "password");
              var result = new Registrator().ApplyForMembership(app);

              _result = new MonkeyFist.Services.Reminders().SendReminderTokenToUser("*****@*****.**");
        }
        public LoggingOut()
        {
            var app = new Application("*****@*****.**", "password", "password");
              var regResult = new Registrator().ApplyForMembership(app);

              _loggedOut = new Authenticator().EndUserSession(regResult.SessionToken);
        }
        public CurrentUserWithSessionToken()
        {
            var app = new Application("*****@*****.**", "password", "password");
              var regResult = new Registrator().ApplyForMembership(app);

              _user = new Authenticator().GetCurrentUser(regResult.SessionToken);
        }
Ejemplo n.º 6
0
 public TokenResponse()
 {
     var app = new Application("*****@*****.**", "password", "password");
       var regResult = new Registrator().ApplyForMembership(app);
       var svc = new MonkeyFist.Services.Reminders().SendReminderTokenToUser(regResult.NewUser.Email);
       result = new MonkeyFist.Services.Reminders().ResetUserPassword(svc.User.ReminderToken, "newPassword");
       user = result.User;
 }
 public ValidApplicationReceived()
     : base()
 {
     _reg = new Registrator();
       var app = new Application(email:"*****@*****.**",password:"******",confirm:"password");
       _result = _reg.ApplyForMembership(app);
       _user = _result.NewUser;
 }
Ejemplo n.º 8
0
        public ValidTokenLogin()
        {
            //register the new user...
              var app = new Application("*****@*****.**", "password", "password");
              var result = new Registrator().ApplyForMembership(app);

              var auth = new Authenticator();
              _result = auth.AuthenticateUserByToken(result.NewUser.AuthenticationToken.ToString());
        }
Ejemplo n.º 9
0
        public ValidLogin()
        {
            //register the new user...
              var app = new Application("*****@*****.**", "password", "password");
              new Registrator().ApplyForMembership(app);

              var auth = new Authenticator();
              _result = auth.AuthenticateUser(new Credentials { Email = "*****@*****.**", Password = "******" });
        }
Ejemplo n.º 10
0
        public TokenResponseExpired()
        {
            var app = new Application("*****@*****.**", "password", "password");
              var regResult = new Registrator().ApplyForMembership(app);

              using (var session = new Session()) {
            var user = session.Users.FirstOrDefault(x => x.Email == regResult.NewUser.Email);
            user.ReminderSentAt = DateTime.Now.AddDays(-1);
            session.SaveChanges();
              }

              result = new MonkeyFist.Services.Reminders().ResetUserPassword(regResult.NewUser.ReminderToken, "newPassword");
        }
Ejemplo n.º 11
0
 public RegistrationResult Register(string email, string password, string confirm, string ipAddress = "127.0.0.1")
 {
     var app = new Application(email, password, confirm);
       return _reg.ApplyForMembership(app);
 }
Ejemplo n.º 12
0
 public ShortPassword()
 {
     var app = new Application("*****@*****.**", "pass", "pass");
       _result = new Registrator().ApplyForMembership(app);
 }
Ejemplo n.º 13
0
 public ShortEmail()
 {
     var app = new Application("rob@b", "password", "password");
       _result = new Registrator().ApplyForMembership(app);
 }
Ejemplo n.º 14
0
        public RegistrationResult ApplyForMembership(Application app)
        {
            var result = new RegistrationResult();

              CurrentApplication = app;
              result.Application = app;
              result.Application.UserMessage = "Welcome!";

              if (EmailOrPasswordNotPresent())
            return InvalidApplication(Properties.Resources.EmailOrPasswordMissing);

              if (EmailIsInvalid())
            return InvalidApplication(Properties.Resources.InvalidEmailMessage);

              if (PasswordIsInvalid())
            return InvalidApplication(Properties.Resources.InvalidPassword);

              if (PasswordDoesNotMatchConfirmation())
            return InvalidApplication(Properties.Resources.PasswordConfirmationMismatch);

              if (EmailAlreadyRegistered())
            return InvalidApplication(Properties.Resources.EmailExists);

              //Accept the application
              result.NewUser = AcceptApplication();

              //log them in
              var auth = new Authenticator().AuthenticateUser(new Credentials { Email = result.NewUser.Email, Password = CurrentApplication.Password });
              result.SessionToken = auth.Session.ID;

              return result;
        }
Ejemplo n.º 15
0
 public PasswordMistmatch()
 {
     var app = new Application("*****@*****.**", "password", "something else");
       _result = new Registrator().ApplyForMembership(app);
 }
Ejemplo n.º 16
0
 public void ApplicationReturnsMessage()
 {
     var app2 = new Application("*****@*****.**", "password", "password");
       _result = new Registrator().ApplyForMembership(app2);
       Assert.Contains("exists", _result.Application.UserMessage);
 }
Ejemplo n.º 17
0
 public void ApplicationIsInvalid()
 {
     var app2 = new Application("*****@*****.**", "password", "password");
       _result = new Registrator().ApplyForMembership(app2);
       Assert.True(app2.IsInvalid());
 }
Ejemplo n.º 18
0
 public void AppDoesntThrow()
 {
     var app2 = new Application("*****@*****.**", "password", "password");
       Assert.DoesNotThrow(() => _result = new Registrator().ApplyForMembership(app2));
 }
Ejemplo n.º 19
0
 public ExistingEmail()
     : base()
 {
     var app1 = new Application("*****@*****.**", "password", "password");
       _result = new Registrator().ApplyForMembership(app1);
 }