Ejemplo n.º 1
0
        private void RenameCheck( )
        {
            string newName = CheckName;

            if (InputDialog.ShowDialog("Rename Check Constraint", "New Name", ref newName) != DialogResult.OK)
            {
                return;
            }

            if (CheckName.ToLowerInvariant() == newName.ToLowerInvariant())
            {
                return;
            }

            DbCmd.RenameCheck(_cp, _owner, _checkName, newName);


            CheckName    = newName;
            txtName.Text = CheckName;

            if (_afterCheckRenamed != null)
            {
                _afterCheckRenamed(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 2
0
        [TestMethod] public void ConstructWithName()
        {
            // Arrange
            var name       = new CheckName("CHECK");
            var mockClause = new Mock <Clause>();

            // Act
            var constraint = new CheckConstraint(name, mockClause.Object);

            // Assert
            constraint.Name.Should().HaveValue(name);
            constraint.Condition.Should().BeSameAs(mockClause.Object);
            mockClause.VerifyNoOtherCalls();
        }
        /// <summary>
        /// Returns true if ContractorCheckResult instances are equal
        /// </summary>
        /// <param name="other">Instance of ContractorCheckResult to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ContractorCheckResult other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     CheckName == other.CheckName ||
                     CheckName != null &&
                     CheckName.Equals(other.CheckName)
                     ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     RiskCodes == other.RiskCodes ||
                     RiskCodes != null &&
                     RiskCodes.Equals(other.RiskCodes)
                 ) &&
                 (
                     IsSucces == other.IsSucces ||
                     IsSucces != null &&
                     IsSucces.Equals(other.IsSucces)
                 ) &&
                 (
                     ContractorName == other.ContractorName ||
                     ContractorName != null &&
                     ContractorName.Equals(other.ContractorName)
                 ) &&
                 (
                     CheckSource == other.CheckSource ||
                     CheckSource != null &&
                     CheckSource.Equals(other.CheckSource)
                 ) &&
                 (
                     IsNeedHandCheck == other.IsNeedHandCheck ||
                     IsNeedHandCheck != null &&
                     IsNeedHandCheck.Equals(other.IsNeedHandCheck)
                 ));
        }
 public override void Perform(InputAction.CallbackContext context)
 {
     //Проверка правильности ввода.
     if (CheckName.Check(NameInputField.text))
     {
         ExitNameState();
         //запись данных в таблицу рекордов.
         ScoreList.Save(NameInputField.text, PlayerScore);
         EnterRecordState();
     }
     else
     {
         //Возврат к вводу, при провале проверки.
         NameInputField.GetComponent <ActiveInputField>().SetActive();
     }
 }
Ejemplo n.º 5
0
        [TestMethod] public void GenerateDeclarationWithName()
        {
            // Arrange
            var name        = new CheckName("CHECK");
            var mockClause  = new Mock <Clause>();
            var constraint  = new CheckConstraint(name, mockClause.Object);
            var mockBuilder = new Mock <IConstraintDeclBuilder>();

            // Act
            constraint.GenerateDeclaration(mockBuilder.Object);

            // Assert
            mockBuilder.Verify(builder => builder.SetName(name));
            mockClause.Verify(clause => clause.AddDeclarationTo(mockBuilder.Object));
            mockBuilder.Verify(builder => builder.Build());
            mockClause.VerifyNoOtherCalls();
            mockBuilder.VerifyNoOtherCalls();
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (CheckName != null)
         {
             hashCode = hashCode * 59 + CheckName.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (RiskCodes != null)
         {
             hashCode = hashCode * 59 + RiskCodes.GetHashCode();
         }
         if (IsSucces != null)
         {
             hashCode = hashCode * 59 + IsSucces.GetHashCode();
         }
         if (ContractorName != null)
         {
             hashCode = hashCode * 59 + ContractorName.GetHashCode();
         }
         if (CheckSource != null)
         {
             hashCode = hashCode * 59 + CheckSource.GetHashCode();
         }
         if (IsNeedHandCheck != null)
         {
             hashCode = hashCode * 59 + IsNeedHandCheck.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 7
0
        private void ProcForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!isSetName || DialogResult != DialogResult.OK || tbName.Text.Length == 0)
            {
                return;
            }

            tbName.Text = tbName.Text.Trim();
            string name = tbName.Text;

            int z = name.IndexOf('(');

            if (z > 0)
            {
                while (true)
                {
                    z = name.IndexOf("variable ", z, StringComparison.OrdinalIgnoreCase);
                    if (z == -1)
                    {
                        break;
                    }
                    name = name.Remove(z, 9);
                }
            }
            // удаление пробелов
            name = name.Replace(" ", "");

            CheckName = name;
            z         = CheckName.IndexOf('(');
            if (z > -1)
            {
                CheckName = CheckName.Remove(z);
            }

            // проверка корректности имени
            for (int i = 0; i < CheckName.Length; i++)
            {
                char ch = CheckName[i];
                if (!TextUtilities.IsLetterDigitOrUnderscore(ch))
                {
                    e.Cancel = true;
                    break;
                }
            }

            if (isCreateProcedure && z > 0)
            {
                int pairCount = 0, pair = 0;
                // проверка корректности аргументов
                for (int i = z; i < name.Length; i++)
                {
                    char ch = name[i];
                    if (ch == ',')
                    {
                        continue;
                    }
                    if (pair > 0 && ch == ')')
                    {
                        pairCount++;
                    }
                    if (ch == '(')
                    {
                        pair++;
                    }
                    if (ch == ')')
                    {
                        pair--;
                    }
                    if (ch == '(' || ch == ')')
                    {
                        continue;
                    }

                    if (!TextUtilities.IsLetterDigitOrUnderscore(ch))
                    {
                        e.Cancel = true;
                        break;
                    }
                }
                if (pair != 0 || pairCount > 1)
                {
                    e.Cancel = true;
                }
            }

            if (e.Cancel)
            {
                MessageBox.Show("Was used incorrect name.\nThe name can only contain alphanumeric characters and the underscore character.", "Incorrect name");
            }
            else
            {
                // вставляем ключевые слова 'variable' для аргументов процедуры
                if (z != -1)
                {
                    z++;
                    int y = name.LastIndexOf(')');
                    if (z == y)
                    {
                        return;         // no args
                    }
                    string pName = name.Substring(0, z - 1);

                    List <byte> args = new List <byte>();
                    for (byte i = (byte)z; i < y; i++)
                    {
                        if (name[i] == ',')
                        {
                            args.Add(i);
                        }
                    }
                    args.Add((byte)y);

                    // извлекаем имена аргументов
                    string argNames = string.Empty;
                    for (byte i = 0; i < args.Count; i++)
                    {
                        int    x       = args[i];
                        string argName = name.Substring(z, x - z).Trim();
                        z = x + 1;

                        if (argName.Length == 0)
                        {
                            continue;
                        }

                        if (!argName.StartsWith("variable "))
                        {
                            argName = argName.Insert(0, "variable ");
                        }
                        if (argNames != string.Empty)
                        {
                            argNames += ", ";
                        }
                        argNames += argName;
                    }
                    tbName.Text = string.Format("{0}({1})", pName, argNames);
                }
            }
        }
Ejemplo n.º 8
0
 public NewGroupForm(CheckName cn)
 {
     this.InitializeComponent();
     this.m_check = cn;
 }