Esempio n. 1
0
        public void Add_Concurrent_AddsOnlyOneElement(TestType value)
        {
            var pSet = new P_OptimizedSet <TestType>();

            pSet = pSet.Add(value);
            pSet = pSet.Add(value);

            Assert.Equal(1, pSet.Elements.Count(v => Equals(v.Value, value)));
        }
Esempio n. 2
0
        public void Lookup_ReAdded_ReturnsFalse(TestType value)
        {
            var pSet = new P_OptimizedSet <TestType>();

            pSet = pSet.Add(value);
            pSet = pSet.Remove(value);
            pSet = pSet.Add(value);

            var lookup = pSet.Lookup(value);

            Assert.False(lookup);
        }
Esempio n. 3
0
        public void Lookup_AddedAndNotRemoved_ReturnsTrue(TestType value)
        {
            var pSet = new P_OptimizedSet <TestType>();

            pSet = pSet.Add(value);

            var lookup = pSet.Lookup(value);

            Assert.True(lookup);
        }
Esempio n. 4
0
        public void Add_AddsElementToAddsSet(TestType value)
        {
            var pSet = new P_OptimizedSet <TestType>();

            pSet = pSet.Add(value);

            var expectedElement = new P_OptimizedSetElement <TestType>(value, false);

            Assert.Contains(expectedElement, pSet.Elements);
        }
Esempio n. 5
0
        public void Remove_AddsRemovedFlagToElement(TestType value)
        {
            var pSet = new P_OptimizedSet <TestType>();

            pSet = pSet.Add(value);
            pSet = pSet.Remove(value);

            var expectedElement    = new P_OptimizedSetElement <TestType>(value, true);
            var notExpectedElement = new P_OptimizedSetElement <TestType>(value, false);

            Assert.Contains(expectedElement, pSet.Elements);
            Assert.DoesNotContain(notExpectedElement, pSet.Elements);
        }