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

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

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

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

            var newOrSet = orSet.Remove(value, tag);

            Assert.Same(orSet, newOrSet);
        }
        public void Remove_AddsElementToRemovesSet(TestType value, Guid tag)
        {
            var orSet = new OR_Set <TestType>();

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

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

            Assert.Contains(element, orSet.Removes);
        }
        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_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 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);
        }