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))); }
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); }
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); }
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); }
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); }