public void Add_Concurrent_AddsOnlyOneElement(TestType value, Guid tag)
        {
            var orSet = new OR_Set <TestType>();

            orSet = orSet.Add(value, tag);
            orSet = orSet.Add(value, tag);

            var element = new OR_SetElement <TestType>(value, tag);

            Assert.Equal(1, orSet.Adds.Count(v => Equals(v, element)));
        }
        public void Lookup_SameValueWithSeveralTags_ReturnsTrue(TestType value, Guid tag)
        {
            var orSet = new OR_Set <TestType>();

            orSet = orSet.Add(value, tag);
            orSet = orSet.Add(value, Guid.NewGuid());
            orSet = orSet.Remove(value, tag);

            var lookup = orSet.Lookup(value);

            Assert.True(lookup);
        }
        public void Add_AddsElementToAddsSet(TestType value, Guid tag)
        {
            var orSet = new OR_Set <TestType>();

            orSet = orSet.Add(value, tag);

            var element = new OR_SetElement <TestType>(value, tag);

            Assert.Contains(element, orSet.Adds);
        }
        public void Lookup_AddedAndNotRemoved_ReturnsTrue(TestType value, Guid tag)
        {
            var orSet = new OR_Set <TestType>();

            orSet = orSet.Add(value, tag);

            var lookup = orSet.Lookup(value);

            Assert.True(lookup);
        }
        public void Values_ReturnsNonRemovedValues(TestType one, TestType two, TestType three, Guid tagOne, Guid tagTwo, Guid tagThree)
        {
            var orSet = new OR_Set <TestType>();

            orSet = orSet.Add(one, tagOne);
            orSet = orSet.Add(one, tagTwo);
            orSet = orSet.Remove(one, tagTwo);
            orSet = orSet.Add(two, tagTwo);
            orSet = orSet.Add(two, tagOne);
            orSet = orSet.Remove(two, tagOne);
            orSet = orSet.Remove(three, tagThree);
            orSet = orSet.Add(three, tagThree);
            orSet = orSet.Remove(three, tagThree);

            var actualValues = orSet.Values;

            Assert.Equal(2, actualValues.Count);
            Assert.Contains(one, actualValues);
            Assert.Contains(two, actualValues);
        }
        public void Lookup_AddedAndRemoved_ReturnsFalse(TestType value, Guid tag)
        {
            var orSet = new OR_Set <TestType>();

            var element = new OR_SetElement <TestType>(value, Guid.NewGuid());

            orSet = orSet.Add(value, tag);
            orSet = orSet.Remove(value, tag);

            var lookup = orSet.Lookup(value);

            Assert.False(lookup);
        }