Example #1
0
    public void Can_Construct_Empty_ValueCollection_With_Default_EqualityComparer()
    {
        // Act
        var actual = new ValueCollection <string>();

        // Assert
        actual.Should().BeEmpty();
    }
Example #2
0
    public void Can_Construct_Prefilled_ValueCollection_With_Default_EqualityComparer()
    {
        // Act
        var actual = new ValueCollection <string>(new[] { "a", "b", "c" });

        // Assert
        actual.Should().BeEquivalentTo(new[] { "a", "b", "c" });
    }
Example #3
0
    public void Can_Construct_Empty_ValueCollection_With_Custom_EqualityComparer()
    {
        // Arrange
        var equalityComparerMock = new Mock <IEqualityComparer <string> >();

        // Act
        var actual = new ValueCollection <string>(equalityComparerMock.Object);

        // Assert
        actual.Should().BeEmpty();
    }
Example #4
0
    public void Can_Construct_Prefilled_ValueCollection_With_Custom_EqualityComparer()
    {
        // Arrange
        var equalityComparerMock = new Mock <IEqualityComparer <string> >();

        equalityComparerMock.Setup(x => x.Equals(It.IsAny <string>(), It.IsAny <string>()))
        .Returns <string, string>((x, y) => x.ToUpperInvariant() == y.ToUpperInvariant());

        // Act
        var actual = new ValueCollection <string>(new[] { "a", "b", "c" }, equalityComparerMock.Object);

        // Assert
        actual.Should().BeEquivalentTo(new[] { "a", "b", "c" });
    }