Beispiel #1
0
        private bool Compare(EntityItemSimpleBaseType valueOfFieldItemType, EntitySimpleBaseType valueOfFieldStateType)
        {
            string itemValue  = valueOfFieldItemType.Value;
            string stateValue = valueOfFieldStateType.Value;

            if ((itemValue == null) && (stateValue == null))
            {
                return(true);
            }

            // If one of objects to compare is null and another one is not null the compare result must be false.
            if (this.IsOneOfTheseObjectsNullAndAnotherOneNotNull(itemValue, stateValue) &&
                string.IsNullOrEmpty(valueOfFieldStateType.var_ref) &&
                valueOfFieldStateType.datatype != SimpleDatatypeEnumeration.@string)
            {
                return(false);
            }

            var value = valueOfFieldStateType.Value;

            if (IsThereDefinedVariable(valueOfFieldStateType))
            {
                value = ProcessVariableById(valueOfFieldStateType.var_ref);
            }

            IOvalComparator comparator    = new OvalComparatorFactory().GetComparator(valueOfFieldStateType.datatype);
            string          firstElement  = itemValue;
            string          secondElement = value;

            return(comparator.Compare(firstElement, secondElement, valueOfFieldStateType.operation));
        }
 private bool CheckDoesNotExistStatusForEntity(EntityItemSimpleBaseType entityItem)
 {
     return
         ((entityItem != null) &&
          (string.IsNullOrEmpty(entityItem.Value)) &&
          (entityItem.status == StatusEnumeration.doesnotexist));
 }
Beispiel #3
0
 public void SetGroupEntityStatus(EntityItemSimpleBaseType groupNameEntity, StatusEnumeration status)
 {
     groupNameEntity.status = status;
     if ((status == StatusEnumeration.doesnotexist) || (status == StatusEnumeration.error))
     {
         groupNameEntity.Value = string.Empty;
     }
 }
Beispiel #4
0
        private bool CompareTwoEntities(PropertyInfo field, PropertyInfo fieldOfOtherItemType)
        {
            EntityItemSimpleBaseType valueOfFieldItemType      = (EntityItemSimpleBaseType)field.GetValue(this.itemType, null);
            EntityItemSimpleBaseType valueOfFieldOtherItemType = (EntityItemSimpleBaseType)fieldOfOtherItemType.GetValue(this.otherItemType, null);

            if ((valueOfFieldItemType != null) && (valueOfFieldOtherItemType != null))
            {
                return(this.Compare(valueOfFieldItemType, valueOfFieldOtherItemType));
            }
            else
            {
                return(this.CheckNullForEntities(valueOfFieldItemType, valueOfFieldOtherItemType));
            }
        }
Beispiel #5
0
        private bool Compare(EntityItemSimpleBaseType valueOfFieldItemType, EntityItemSimpleBaseType valueOfFieldOtherItemType)
        {
            if ((valueOfFieldItemType.Value == null) && (valueOfFieldOtherItemType.Value == null))
            {
                return(true);
            }


            if (valueOfFieldItemType.status != valueOfFieldOtherItemType.status)
            {
                return(false);
            }

            IOvalComparator comparator = new OvalComparatorFactory().GetComparator(valueOfFieldItemType.datatype);

            return(comparator.Compare(valueOfFieldItemType.Value, valueOfFieldOtherItemType.Value, OperationEnumeration.equals));
        }
Beispiel #6
0
 private void AssertEnvironmentVariableItemEntity(EntityItemSimpleBaseType entityToAssert, string expectedValue)
 {
     Assert.IsNotNull(entityToAssert);
     Assert.IsFalse(string.IsNullOrEmpty(entityToAssert.Value));
     Assert.AreEqual(entityToAssert.Value, expectedValue);
 }
Beispiel #7
0
 private bool IsItemEntityDefined(EntityItemSimpleBaseType itemEntity)
 {
     return((itemEntity != null) && (!string.IsNullOrEmpty(itemEntity.Value)));
 }
 private void AssertItemTypeEntity(EntityItemSimpleBaseType entityToAssert, string expectedEntityVale)
 {
     Assert.IsNotNull(entityToAssert);
     Assert.IsFalse(string.IsNullOrEmpty(entityToAssert.Value));
     Assert.AreEqual(expectedEntityVale, entityToAssert.Value);
 }
 /// <summary>
 /// It checks the entity item value.
 /// </summary>
 /// <param name="entityToAssert">Item entity to assert.</param>
 /// <param name="expectedValue">Expected entity item value.</param>
 public static void AssertItemTypeEntity(EntityItemSimpleBaseType entityToAssert, string expectedValue, string entityName = "")
 {
     Assert.IsNotNull(entityToAssert, "The '{0}' entity cannot be null.", entityName);
     Assert.IsNotNull(entityToAssert.Value, "The '{0}' entity value cannot be null", entityName);
     Assert.AreEqual(expectedValue, entityToAssert.Value, "Unexpected value was found for '{0}' entity.", entityName);
 }
Beispiel #10
0
 private void AssertMetabaseEntity(EntityItemSimpleBaseType entityToAssert, string expectedEntityValue)
 {
     Assert.IsNotNull(entityToAssert, "A null metabase entity was found.");
     Assert.AreEqual(expectedEntityValue, entityToAssert.Value, "An unexpected entity value was found..");
 }
Beispiel #11
0
 private bool CheckNullForEntities(EntityItemSimpleBaseType valueOfFieldItemType, EntityItemSimpleBaseType valueOfFieldOtherItemType)
 {
     return((valueOfFieldItemType == null) && (valueOfFieldOtherItemType == null));
 }
Beispiel #12
0
        private  bool Compare(EntityItemSimpleBaseType valueOfFieldItemType, EntityItemSimpleBaseType valueOfFieldOtherItemType)
        {           
            if ((valueOfFieldItemType.Value == null) && (valueOfFieldOtherItemType.Value == null))
                return true;


            if (valueOfFieldItemType.status != valueOfFieldOtherItemType.status)
                return false;

            IOvalComparator comparator = new OvalComparatorFactory().GetComparator(valueOfFieldItemType.datatype);
            return comparator.Compare(valueOfFieldItemType.Value, valueOfFieldOtherItemType.Value, OperationEnumeration.equals);
        }
Beispiel #13
0
 private bool CheckNullForEntities(EntityItemSimpleBaseType valueOfFieldItemType, EntityItemSimpleBaseType valueOfFieldOtherItemType)
 {
     return (valueOfFieldItemType == null) && (valueOfFieldOtherItemType == null);
         
 }
Beispiel #14
0
 protected void SetEntityStatus(EntityItemSimpleBaseType entity, StatusEnumeration status)
 {
     entity.status = status;
 }
Beispiel #15
0
 private void AssertRegistryEntityItem(EntityItemSimpleBaseType entityToAssert, string expectedEntityValue)
 {
     Assert.IsNotNull(entityToAssert);
     Assert.AreEqual(StatusEnumeration.exists, entityToAssert.status);
     Assert.AreEqual(expectedEntityValue, entityToAssert.Value);
 }