示例#1
0
        /// <inheritdoc/>
        public virtual void SequenceEqual <T>(IEnumerable <T> expected, IEnumerable <T> actual, IEqualityComparer <T>?equalityComparer = null, string?message = null)
        {
            var comparer = new SequenceEqualEnumerableEqualityComparer <T>(equalityComparer);
            var areEqual = comparer.Equals(expected, actual);

            if (!areEqual)
            {
                throw new InvalidOperationException(CreateMessage(message ?? $"Sequences are not equal"));
            }
        }
示例#2
0
        public void SequenceEqual <T>(IEnumerable <T> expected, IEnumerable <T> actual, IEqualityComparer <T> equalityComparer = null, string message = null)
        {
            var comparer = new SequenceEqualEnumerableEqualityComparer <T>(equalityComparer);
            var areEqual = comparer.Equals(expected, actual);

            if (!areEqual)
            {
                Assert.Fail(message);
            }
        }
示例#3
0
 public void SequenceEqual <T>(IEnumerable <T> expected, IEnumerable <T> actual, IEqualityComparer <T> equalityComparer = null, string message = null)
 {
     if (message is null)
     {
         if (equalityComparer is null)
         {
             Assert.Equal(expected, actual);
         }
         else
         {
             Assert.Equal(expected, actual, equalityComparer);
         }
     }
     else
     {
         var comparer = new SequenceEqualEnumerableEqualityComparer <T>(equalityComparer);
         var areEqual = comparer.Equals(expected, actual);
         if (!areEqual)
         {
             Assert.True(false, message);
         }
     }
 }