Example #1
0
            public void ShouldReturnTrue_WhenGivenNulls()
            {
                // Arrange
                var sut = new SetComparer <int>();

                // Act
                bool result = sut.Equals(null, null);

                // Assert
                Assert.True(result);
            }
Example #2
0
            public void ShouldReturnFalse_WhenGivenCollectionAndNull()
            {
                // Arrange
                var set0 = new int[0];
                var sut  = new SetComparer <int>();

                // Act
                bool result = sut.Equals(set0, null);

                // Assert
                Assert.False(result);
            }
Example #3
0
            public void ShouldReturnTrue_WhenGivenEmptyCollections()
            {
                // Arrange
                var set0 = new int[0];
                var set1 = new List <int>();
                var sut  = new SetComparer <int>();

                // Act
                bool result = sut.Equals(set0, set1);

                // Assert
                Assert.True(result);
            }
Example #4
0
            public void ShouldUseGivenComparerForComparisons()
            {
                // Arrange
                var set0 = new[] { "B", "D", "g", "g", "A", "C", "E", "e", "E" };
                var set1 = new[] { "b", "d", "G", "G", "A", "C", "e", "e", "e" };
                var sut  = new SetComparer <string>(StringComparer.OrdinalIgnoreCase);

                // Act
                bool result = sut.Equals(set0, set1);

                // Assert
                Assert.True(result);
            }