public void CanRegistrateUserWithWrongPassword() { var registration = new UserActions(); //password is too short try { var user = new PreRegistrateUser { Login = "******", Password = "******", ConfirmPassword = "******", Email = "*****@*****.**", Info = "dsfsdfsdf" }; registration.TryRegistrateUser(user); } catch (Exception ex) { Assert.AreEqual(ex.GetType(), typeof(PasswordIncorrectedException)); } finally { //password too long try { var user = new PreRegistrateUser { Login = "******", Password = "******", ConfirmPassword = "******", Email = "*****@*****.**", Info = "dsfsdfsdf" }; registration.TryRegistrateUser(user); } catch (Exception ex) { Assert.AreEqual(ex.GetType(), typeof(PasswordIncorrectedException)); } finally { //password doesn't include number try { var user = new PreRegistrateUser { Login = "******", Password = "******", ConfirmPassword = "******", Email = "*****@*****.**", Info = "dsfsdfsdf" }; registration.TryRegistrateUser(user); } catch (Exception ex) { Assert.AreEqual(ex.GetType(), typeof(PasswordIncorrectedException)); } //password includes some wrong numbers finally { try { var user = new PreRegistrateUser { Login = "******", Password = "******", ConfirmPassword = "******", Email = "*****@*****.**", Info = "dsfsdfsdf" }; registration.TryRegistrateUser(user); } catch (Exception ex) { Assert.AreEqual(ex.GetType(), typeof(PasswordIncorrectedException)); } } } } }
public void CanRegistrateUserWithErrorLogin() { var registration = new UserActions(); //login is too short try { var user = new PreRegistrateUser { Login = "******", Password = "******", ConfirmPassword = "******", Email = "*****@*****.**", Info = "dsfsdfsdf" }; registration.TryRegistrateUser(user); } catch (Exception ex) { Assert.AreEqual(ex.GetType(), typeof(LoginIncorrectedException)); } finally { //login to long try { var user = new PreRegistrateUser { Login = "******", Password = "******", ConfirmPassword = "******", Email = "*****@*****.**", Info = "dsfsdfsdf" }; registration.TryRegistrateUser(user); } catch (Exception ex) { Assert.AreEqual(ex.GetType(), typeof(LoginIncorrectedException)); } finally { //login includes wrong symbols try { var user = new PreRegistrateUser { Login = "******", Password = "******", ConfirmPassword = "******", Email = "*****@*****.**", Info = "dsfsdfsdf" }; registration.TryRegistrateUser(user); } catch (Exception ex) { Assert.AreEqual(ex.GetType(), typeof(LoginIncorrectedException)); } } } }