コード例 #1
0
        //[Test]
        public void ValidUsernamesTest()
        {
            IInputValidationService service        = new InputValidationService();
            List <string>           validUsernames = FileUtils.FileToStringList(TestFiles.ValidUsernames);

            foreach (string username in validUsernames)
            {
                Assert.DoesNotThrow(() =>
                {
                    service.ValidateUsername(username);
                });
            }
        }
コード例 #2
0
        public static Consultant GetValidConsultant()
        {
            Consultant             consultant = GetConsultant();
            InputValidationService service    = new InputValidationService();

            try
            {
                service.ValidateUsername(consultant.Username);
                service.ValidateFirstName(consultant.FirstName);
                service.ValidateLastName(consultant.LastName);
                service.ValidateEmail(consultant.Email);
                service.ValidateContact(consultant.Contact);
            }
            catch (InputValidationException e)
            {
                Logger.Debug(e);
                consultant = null;
                throw;
            }

            return(consultant);
        }
コード例 #3
0
        public static Account GetValidAccount()
        {
            Account account = GetAccount();
            InputValidationService service = new InputValidationService();

            try
            {
                service.ValidateUsername(account.Username);
                service.ValidateFirstName(account.FirstName);
                service.ValidateLastName(account.LastName);
                service.ValidateEmail(account.Email);
                service.ValidateContact(account.Contact);
            }
            catch (InputValidationException e)
            {
                Logger.Debug(e);
                account = null;
                throw;
            }

            return(account);
        }