示例#1
0
        public void should_return_index_of_repeated_object_array_with_builtin_equality_comparer()
        {
            var testCase1 = new test_class_builtin_comparer()
            {
                A = "a", B = 0
            };
            var testCase2 = new test_class_builtin_comparer()
            {
                A = "b", B = 1
            };
            var testCase3 = new test_class_builtin_comparer()
            {
                A = "c", B = 2
            };
            var testCase4 = new test_class_builtin_comparer()
            {
                A = "d", B = 3
            };
            var testCase5 = new test_class_builtin_comparer()
            {
                A = "d", B = 3
            };

            var testCases = new[] { testCase1, testCase2, testCase3, testCase4, testCase5, testCase5 };

            var indexesOfRepeats = testCases.IndexesOfRepeats().ToList();

            indexesOfRepeats.Should().HaveCount(1);
            indexesOfRepeats.Should().BeEquivalentTo(new[] { 3 });
        }
示例#2
0
 private bool Equals(test_class_builtin_comparer other)
 {
     return(string.Equals(A, other.A) && B == other.B);
 }