Exemplo n.º 1
0
 public void SetUp()
 {
     _comparer = new Comparer <Message>(
         new ComparisonSettings
     {
         //Null and empty error lists are equal
         EmptyAndNullEnumerablesEqual = true
     });
     //Do not compare Dates
     _comparer.AddComparerOverride <DateTime>(DoNotCompareValueComparer.Instance);
     //Do not compare Id
     _comparer.AddComparerOverride(() => new Message().Id, DoNotCompareValueComparer.Instance);
     //Do not compare Message Text
     _comparer.AddComparerOverride(() => new Error().Messgae, DoNotCompareValueComparer.Instance);
 }
            public override IComparer <T> GetObjectsComparer <T>(ComparisonSettings settings = null,
                                                                 BaseComparer parentComparer = null)
            {
                IComparer <T> comparer = base.GetObjectsComparer <T>(settings, parentComparer);

                if (parentComparer == null)
                {
                    comparer.AddComparerOverride(typeof(string), new IgnoreCaseStringsValueComparer());
                }

                return(comparer);
            }