public void Lookup_ValueDoesNotExist_ReturnsFalse(List <TestType> values, TestType value)
        {
            var gSet = new G_Set <TestType>(values.ToImmutableHashSet());

            var exists = gSet.Lookup(value);

            Assert.False(exists);
        }
Example #2
0
        public void Add_AddsElementToTheSet(TestType value)
        {
            var gSet = new G_Set <TestType>();

            gSet = gSet.Add(value);

            Assert.Contains(value, gSet.Values);
        }
Example #3
0
        public void Add_Concurrent_AddsOnlyOneElement(TestType value)
        {
            var gSet = new G_Set <TestType>();

            gSet = gSet.Add(value);
            gSet = gSet.Add(value);

            Assert.Equal(1, gSet.Values.Count(v => Equals(v, value)));
        }
Example #4
0
        public void Lookup_ValueExists_ReturnsTrue(List <TestType> values, TestType value)
        {
            var gSet = new G_Set <TestType>(values.ToImmutableHashSet());

            gSet = gSet.Add(value);

            var exists = gSet.Lookup(value);

            Assert.True(exists);
        }
        public void Merge_MergesValues(TestType one, TestType two, TestType three)
        {
            var gSet = new G_Set <TestType>(new[] { one, two }.ToImmutableHashSet());

            var values = new[] { two, three }.ToImmutableHashSet();

            var newGSet = gSet.Merge(values);

            Assert.Equal(3, newGSet.Values.Count);
            Assert.Contains(one, newGSet.Values);
            Assert.Contains(two, newGSet.Values);
            Assert.Contains(three, newGSet.Values);
        }
        public void Create_CreatesSetWithElements(TestType one, TestType two, TestType three)
        {
            var values = new[] { one, two, three }.ToImmutableHashSet();

            var gSet = new G_Set <TestType>(values);

            Assert.Equal(values.Count, gSet.Values.Count);

            foreach (var value in values)
            {
                Assert.Contains(value, gSet.Values);
            }
        }