Contains() public method

public Contains ( int value ) : bool
value int
return bool
    public void When_the_element_is_not_in_the_set()
    {
        var element = 4;
        var sut     = new CustomSet(new[] { 1, 2, 3 });

        Assert.False(sut.Contains(element));
    }
    public void Nothing_is_contained_in_an_empty_set()
    {
        var element = 1;
        var sut     = new CustomSet();

        Assert.False(sut.Contains(element));
    }
示例#3
0
    public CustomSet Difference(CustomSet right)
    {
        CustomSet     res  = this.Intersection(right);
        HashSet <int> res1 = new HashSet <int>();

        foreach (int val in this.hash)
        {
            if (!right.Contains(val))
            {
                res1.Add(val);
            }
        }
        return(new CustomSet(res1));
    }
示例#4
0
    public void Detect_if_the_element_is_not_in_the_set()
    {
        var actual = new CustomSet <int>(new[] { 1, 2, 3 });

        Assert.False(actual.Contains(4));
    }
示例#5
0
    public void Nothing_is_contained_in_an_empty_set()
    {
        var actual = new CustomSet <int>();

        Assert.False(actual.Contains(1));
    }
示例#6
0
    public void Detect_if_the_element_is_in_the_set()
    {
        var actual = new CustomSet <int>(new[] { 1, 2, 3 });

        Assert.That(actual.Contains(1), Is.True);
    }