Example #1
0
            public FluentMessage BuildMessage <T>(IChecker <T, ICheck <T> > checker, bool negated)
            {
                FluentMessage result = null;

                if (this.DoValuesMatches == negated)
                {
                    if (negated)
                    {
                        result =
                            checker.BuildShortMessage(
                                string.Format(
                                    "The {{0}}'s {0} has the same value in the comparand, whereas it must not.",
                                    this.Expected.FieldLabel.DoubleCurlyBraces()));
                        EqualityHelper.FillEqualityErrorMessage(result, this.actual.Value, this.expected.Value, true);
                    }
                    else
                    {
                        if (!this.ExpectedFieldFound)
                        {
                            result = checker.BuildShortMessage(
                                string.Format(
                                    "The {{0}}'s {0} is absent from the {{1}}.",
                                    this.Expected.FieldLabel.DoubleCurlyBraces()));
                            result.Expected(this.expected.Value);
                        }
                        else
                        {
                            result =
                                checker.BuildShortMessage(
                                    string.Format(
                                        "The {{0}}'s {0} does not have the expected value.",
                                        this.Expected.FieldLabel.DoubleCurlyBraces()));
                            EqualityHelper.FillEqualityErrorMessage(result, this.actual.Value, this.expected.Value, false);
                        }
                    }
                }

                return(result);
            }