示例#1
0
        public override CompoundSemanticException WildExceptions()
        {
#if EXTRA_CONTRACTS
            Contract.Ensures(!State.HasValue ==
                             Contract.Result <CompoundSemanticException>().ContainsElement(new PropertyException(this, "State", ExceptionStrings.Mandatory, null)));
            Contract.Ensures(State.HasValue && !IsSingleTaskState(State.Value) ==
                             Contract.Result <CompoundSemanticException>().ContainsElement(new PropertyException(this, "State", ExceptionStrings.EnumFlagsSingleOption, null)));
            Contract.Ensures(string.IsNullOrEmpty(TaskType) ==
                             Contract.Result <CompoundSemanticException>().ContainsElement(new PropertyException(this, "TaskType", ExceptionStrings.Mandatory, null)));
            Contract.Ensures(string.IsNullOrEmpty(Reference) ==
                             Contract.Result <CompoundSemanticException>().ContainsElement(new PropertyException(this, "Reference", ExceptionStrings.Mandatory, null)));
#endif

            CompoundSemanticException cse = base.WildExceptions();

            if (!State.HasValue)
            {
                cse.AddElement(new PropertyException(this, "State", MandatoryMessage, null));
            }
            if (State.HasValue && !IsSingleTaskState(State.Value))
            {
                cse.AddElement(new PropertyException(this, "State", EnumFlagsSingleOption, null));
            }
            if (string.IsNullOrEmpty(TaskType))
            {
                cse.AddElement(new PropertyException(this, "TaskType", MandatoryMessage, null));
            }

            return(cse);
        }
示例#2
0
        public override CompoundSemanticException WildExceptions()
        {
            CompoundSemanticException sce = base.WildExceptions();

            if (Company == null)
            {
                sce.AddElement(new PropertyException(this, "Company", PropertyException.MandatoryMessage, null));
            }

            return(sce);
        }
示例#3
0
        public override CompoundSemanticException WildExceptions()
        {
            CompoundSemanticException cpe = base.WildExceptions();

            if (MockWild)
            {
                cpe.AddElement(new SemanticException("TEST"));
            }

            return(cpe);
        }
示例#4
0
        public static CompoundSemanticException Compact([CanBeNull] IEnumerable <CompoundSemanticException> compoundSemanticExceptions)
        {
            if ((compoundSemanticExceptions != null) && compoundSemanticExceptions.Any())
            {
                CompoundSemanticException compactedCompoundSemanticException = new CompoundSemanticException();
                foreach (CompoundSemanticException cse in compoundSemanticExceptions)
                {
                    foreach (SemanticException se in GetSemanticExceptions(cse).Where(se => !compactedCompoundSemanticException.ContainsElement(se)))
                    {
                        compactedCompoundSemanticException.AddElement(se);
                    }
                }

                return(compactedCompoundSemanticException);
            }

            return(null);
        }