public void EntToEnd_WithCustomComparer()
        {
            var dict  = new HashSet <EverythingEquals>(ReferenceEqualityComparer <EverythingEquals> .Default);
            var item1 = new EverythingEquals();
            var item2 = new EverythingEquals();

            dict.Add(item1);
            var added = dict.Add(item2);

            Assert.True(added);
        }
        public void EntToEnd_WithoutCustomComparer()
        {
            var dict  = new HashSet <EverythingEquals>();
            var item1 = new EverythingEquals();
            var item2 = new EverythingEquals();

            dict.Add(item1);
            var added = dict.Add(item2);

            Assert.False(added, $"since {nameof(EverythingEquals)} implements IEquatable<>, that implementation is used by default");
        }
Exemplo n.º 3
0
        public void EntToEnd_WithoutCustomComparer()
        {
            // Arrange
            var dict  = new HashSet <EverythingEquals>();
            var item1 = new EverythingEquals();
            var item2 = new EverythingEquals();

            // Act
            dict.Add(item1);
            var added = dict.Add(item2);

            // Assert
            added.Should().BeFalse($"since {nameof(EverythingEquals)} implements IEquatable<>, that implementation is used by default");
        }
Exemplo n.º 4
0
        public void EntToEnd_WithCustomComparer()
        {
            // Arrange
            var dict  = new HashSet <EverythingEquals>(ReferenceEqualityComparer <EverythingEquals> .Default);
            var item1 = new EverythingEquals();
            var item2 = new EverythingEquals();

            // Act
            dict.Add(item1);
            var added = dict.Add(item2);

            // Assert
            added.Should().BeTrue();
        }