Beispiel #1
0
        private void VerifyMinMax()
        {
            if ((RestrictionField & RestrictionField.MinExclusive) == RestrictionField.MinExclusive)
            {
                Debug.Assert(MinExclusive.CompareTo(MinValue) >= 0);
            }
            if ((RestrictionField & RestrictionField.MaxExclusive) == RestrictionField.MaxExclusive)
            {
                Debug.Assert(MaxExclusive.CompareTo(MaxValue) <= 0);
            }
            if ((RestrictionField & RestrictionField.MinMaxExclusive) == RestrictionField.MinMaxExclusive)
            {
                Debug.Assert(MinExclusive.CompareTo(MaxExclusive) < 0);
            }

            if ((RestrictionField & RestrictionField.MinInclusive) == RestrictionField.MinInclusive)
            {
                Debug.Assert(MinInclusive.CompareTo(MinValue) >= 0);
            }
            if ((RestrictionField & RestrictionField.MaxInclusive) == RestrictionField.MaxInclusive)
            {
                Debug.Assert(MaxInclusive.CompareTo(MaxValue) <= 0);
            }
            if ((RestrictionField & RestrictionField.MinMaxInclusive) == RestrictionField.MinMaxInclusive)
            {
                Debug.Assert(MinInclusive.CompareTo(MaxInclusive) <= 0);
            }
        }
Beispiel #2
0
        /// <inheritdoc />
        public override bool IsMaxInclusiveValid(OpenXmlSimpleType attributeValue)
        {
            Debug.Assert(attributeValue is ST);
            ST simpleValue = (ST)attributeValue;

            if ((RestrictionField & RestrictionField.MaxInclusive) == RestrictionField.MaxInclusive)
            {
                // true if this.MaxInclusive >= simpleValue.Value
                if (MaxInclusive.CompareTo(simpleValue.Value) < 0)
                {
                    return(false);
                }
            }
            return(true);
        }