示例#1
0
        }         // NonAffirmativeTraces

        public override string ToString()
        {
            var lst = new List <Tuple <string, string, string, string> >();

            int nFirstFieldLength  = 0;
            int nSecondFieldLength = 0;

            for (int i = 0; i < this.m_oSteps.Count; i++)
            {
                ATrace oTrace = this.m_oSteps[i];

                string sDecisionName = GetDecisionName(oTrace.DecisionStatus);

                if (nFirstFieldLength < sDecisionName.Length)
                {
                    nFirstFieldLength = sDecisionName.Length;
                }

                if (nSecondFieldLength < oTrace.Name.Length)
                {
                    nSecondFieldLength = oTrace.Name.Length;
                }

                lst.Add(new Tuple <string, string, string, string>(
                            sDecisionName,
                            oTrace.Name,
                            oTrace.Comment,
                            oTrace.HasLockedDecision ? "LOCKED DECISION " : string.Empty
                            ));
            }             // for

            var os = new StringBuilder();

            string sFormat = string.Format(
                "\t{{0,{0}}}. '{{1,-{1}}}' {{4}}{{2,-{2}}} {{3}}\n",
                lst.Count.ToString("G", CultureInfo.InvariantCulture).Length,
                nFirstFieldLength,
                nSecondFieldLength + 1
                );

            for (int i = 0; i < lst.Count; i++)
            {
                Tuple <string, string, string, string> tpl = lst[i];
                os.AppendFormat(sFormat, i + 1, tpl.Item1, tpl.Item2 + ':', tpl.Item3, tpl.Item4);
            }             // for each

            return(string.Format(
                       "decision for '{0}' is '{1}'. Decision trail:\n{2}\tOverall: decision for '{0}' is '{1}'.",
                       Decision,
                       GetDecisionName(),
                       os
                       ));
        }         // ToString
示例#2
0
            }             // StepType

            internal StepWithDecision(ATrace step, DecisionStatus decision)
            {
                Step     = step;
                Decision = decision;
            }     // constructor
示例#3
0
        }         // ToString

        public virtual bool EqualsTo(ATrail oTrail, bool bQuiet = false)
        {
            if (oTrail == null)
            {
                const string sMsg = "The second trail is not specified.";
                AddNote(sMsg);

                if (!bQuiet)
                {
                    this.m_oLog.Warn("Trails are different: {0}", sMsg);
                    // ReSharper disable ExpressionIsAlwaysNull
                    SendExplanationMail(oTrail, sMsg: sMsg);
                    // ReSharper restore ExpressionIsAlwaysNull
                }                 // if

                return(false);
            }             // if

            if (GetType() != oTrail.GetType())
            {
                string sMsg = string.Format(
                    "This trail is of for decision '{0}' while the second one is for '{1}'.",
                    Decision,
                    oTrail.Decision
                    );

                AddNote(sMsg);

                if (!bQuiet)
                {
                    this.m_oLog.Warn("Trails are different: {0}", sMsg);
                    SendExplanationMail(oTrail, sMsg);
                }                 // if

                return(false);
            }             // if

            bool bResult = true;

            if (DecisionStatus != oTrail.DecisionStatus)
            {
                bResult = false;

                string sMsg = string.Format(
                    "Different conclusions for '{2}' have been reached: '{0}' in this vs '{1}' in the second.",
                    GetDecisionName(),
                    oTrail.GetDecisionName(),
                    Decision
                    );

                AddNote(sMsg);

                if (!bQuiet)
                {
                    this.m_oLog.Warn("Trails are different: {0}", sMsg);
                    SendExplanationMail(oTrail, sMsg);
                }         // if
            }             // if

            if (Amount != oTrail.Amount)
            {
                bResult = false;

                string sMsg = string.Format(
                    "Different amount for '{2}' have been reached: '{0}' in this vs '{1}' in the second.",
                    Amount.HasValue ? Amount.Value.ToString(CultureInfo.InvariantCulture) : "no value",
                    oTrail.Amount.HasValue ? oTrail.Amount.Value.ToString(CultureInfo.InvariantCulture) : "no value",
                    Decision
                    );

                AddNote(sMsg);

                if (!bQuiet)
                {
                    this.m_oLog.Warn("Trails are different: {0}", sMsg);
                    SendExplanationMail(oTrail, sMsg);
                }         // if
            }             // if

            if (Length != oTrail.Length)
            {
                string sMsg = string.Format(
                    "Different number of steps in the trail: {0} in this vs {1} in the second.",
                    Length, oTrail.Length
                    );

                AddNote(sMsg);

                if (!bQuiet)
                {
                    this.m_oLog.Warn("Trails are different: {0}", sMsg);
                    SendExplanationMail(oTrail, sMsg);
                }                 // if

                return(false);
            }             // if

            for (int i = 0; i < Length; i++)
            {
                ATrace oMyTrace    = this.m_oSteps[i];
                ATrace oOtherTrace = oTrail.m_oSteps[i];

                if (oMyTrace.GetType() != oOtherTrace.GetType())
                {
                    bResult = false;

                    string sMsg = string.Format(
                        "Different checks for '{3}' encountered on step {0}: {1} in this vs {2} in the second.",
                        i + 1,
                        oMyTrace.GetType().Name,
                        oOtherTrace.GetType().Name,
                        Decision
                        );

                    AddNote(sMsg);

                    if (!bQuiet)
                    {
                        this.m_oLog.Warn("Trails are different: {0}", sMsg);
                    }
                }
                else if (oMyTrace.DecisionStatus != oOtherTrace.DecisionStatus)
                {
                    if (!oMyTrace.AllowMismatch)
                    {
                        bResult = false;
                    }

                    string sMsg = string.Format(
                        "Different conclusions for '{4}' have been reached on step {0} - {1}: " +
                        "{2} in the first vs {3} in the second.",
                        i + 1,
                        oMyTrace.GetType().Name,
                        oMyTrace.DecisionStatus,
                        oOtherTrace.DecisionStatus,
                        Decision
                        );

                    AddNote(sMsg);

                    if (!bQuiet)
                    {
                        this.m_oLog.Warn("Trails are different: {0}", sMsg);
                        SendExplanationMail(oTrail, sMsg);
                    }             // if
                }                 // if
                else if (oMyTrace.HasLockedDecision != oOtherTrace.HasLockedDecision)
                {
                    if (!oMyTrace.AllowMismatch)
                    {
                        bResult = false;
                    }

                    string sMsg = string.Format(
                        "Different conclusions for '{4}' decision lock have been reached on step {0} - {1}: " +
                        "{2} in the first vs {3} in the second.",
                        i + 1,
                        oMyTrace.GetType().Name,
                        oMyTrace.HasLockedDecision ? "locked" : "not locked",
                        oOtherTrace.HasLockedDecision ? "locked" : "not locked",
                        Decision
                        );

                    AddNote(sMsg);

                    if (!bQuiet)
                    {
                        this.m_oLog.Warn("Trails are different: {0}", sMsg);
                        SendExplanationMail(oTrail, sMsg);
                    }     // if
                }         // if
            }             // for

            return(bResult);
        }         // EqualsTo