public void AddRemoveAddRemove_Add_CorrectContents() { //arrange var set = new SnapshotSet <int>(10); set.Add(1); set.Remove(1); set.Add(2); set.Remove(2); //act set.Add(3); //assert var snapshot = set.GetSnapShot(); Assert.That(snapshot[0], Is.EqualTo(3)); Assert.That(snapshot.Length, Is.EqualTo(1)); }
public void Test_FromLogs() { //arrange var set = new SnapshotSet <IPEndPoint>(10); var deadpool = new UserIPEndPoint(2000, new IPEndPoint(IPAddress.Parse("192.168.1.6"), 5061)); set.Add(deadpool); var ironMan = new UserIPEndPoint(1004, new IPEndPoint(IPAddress.Parse("192.168.1.6"), 5062)); set.Add(ironMan); set.Remove(ironMan); ironMan = new UserIPEndPoint(1004, new IPEndPoint(IPAddress.Parse("192.168.1.6"), 5062)); set.Add(ironMan); set.Remove(deadpool); deadpool = new UserIPEndPoint(2000, new IPEndPoint(IPAddress.Parse("192.168.1.6"), 5061)); set.Add(deadpool); set.Remove(ironMan); ironMan = new UserIPEndPoint(1004, new IPEndPoint(IPAddress.Parse("192.168.1.6"), 5061)); set.Add(ironMan); set.Remove(deadpool); deadpool = new UserIPEndPoint(2000, new IPEndPoint(IPAddress.Parse("192.168.1.6"), 5062)); set.Add(deadpool); //act //assert var snapshot = set.GetSnapShot(); Assert.That(snapshot.Length, Is.EqualTo(2)); Assert.That(SpanHas(snapshot, ironMan), Is.True); Assert.That(SpanHas(snapshot, deadpool), Is.True); }
public void Remove_LastItem_IsRemoved() { //arrange var set = new SnapshotSet <int>(10); set.Add(1); //act set.Remove(1); //assert var snapshot = set.GetSnapShot(); Assert.That(snapshot.Length, Is.EqualTo(0)); }
public void Remove_NotLocked_IsRemoved() { //arrange var set = new SnapshotSet <int>(10); set.Add(1); set.Add(2); set.Add(3); //act set.Remove(2); //assert var snapshot = set.GetSnapShot(); Assert.That(snapshot[0], Is.EqualTo(1)); Assert.That(snapshot[1], Is.EqualTo(3)); Assert.That(snapshot.Length, Is.EqualTo(2)); }
public void RemoveServingNode(IPEndPoint endPoint) { _set.Remove(endPoint); }