public void LengthValid_StartNull_EmptyString_ReturnFalse()
        {
            int               start   = 0;
            int               end     = 6;
            Label             eLabel  = new Label();
            string            text    = "";
            string            name    = "Имя";
            ValidationServise service = new ValidationServise(new Label());
            bool              result  = service.LengthValid(start, end, eLabel, text, name);

            Assert.IsFalse(result);
        }
예제 #2
0
        public bool FieldsValidation(Data data, int selectedType)
        {
            switch (selectedType)
            {
            case 0:
                bool numValidP  = vServise.LengthValid(10, 20, numErrorLabel, data.Number, "Телефон");
                bool addrValidP = vServise.LengthValid(0, 300, addrErrorLabel, data.Address, "Адрес");
                bool surValid   = vServise.LengthValid(0, 20, surErrorLabel, data.Surname, "Фамилия");
                bool nameValid  = vServise.LengthValid(0, 20, nameErrorLabel, data.Name, "Имя");
                bool patrValid  = vServise.LengthValid(0, 20, patrErrorLabel, data.Patronymic, "Отчество");
                if (numValidP && addrValidP && surValid && nameValid && patrValid)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case 1:
                bool numValidC  = vServise.LengthValid(10, 20, numErrorLabel, data.Number, "Телефон");
                bool addrValidC = vServise.LengthValid(0, 300, addrErrorLabel, data.Address, "Адрес");
                bool compValid  = vServise.LengthValid(0, 100, compErrorLabel, data.Company, "Название компании");
                bool occupValid = data.Occupation != null;

                if (numValidC && addrValidC && compValid && occupValid)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            default:
                return(false);
            }
        }