public void ShouldNotFailIfTryingToRemoveNotExistingSequence() { var group = new SequenceGroup(); group.Add(new Sequence()); group.Add(new Sequence()); group.remove(new Sequence()); }
public void ShouldAddOneSequenceToGroup() { var sequence = new Sequence(7L); var sequenceGroup = new SequenceGroup(); sequenceGroup.Add(sequence); Assert.AreEqual(sequence.Value, sequenceGroup.Value); }
public void ShouldReportSizeOfGroup() { var sequenceGroup = new SequenceGroup(); sequenceGroup.Add(new Sequence()); sequenceGroup.Add(new Sequence()); sequenceGroup.Add(new Sequence()); Assert.AreEqual(3, sequenceGroup.Size); }
public void ShouldReportTheMinimumSequenceForGroupOfTwo() { var sequenceThree = new Sequence(3L); var sequenceSeven = new Sequence(7L); var sequenceGroup = new SequenceGroup(); sequenceGroup.Add(sequenceSeven); sequenceGroup.Add(sequenceThree); Assert.AreEqual(sequenceThree.Value, sequenceGroup.Value); }
public void ShouldRemoveSequenceFromGroup() { var sequenceThree = new Sequence(3L); var sequenceSeven = new Sequence(7L); var sequenceGroup = new SequenceGroup(); sequenceGroup.Add(sequenceSeven); sequenceGroup.Add(sequenceThree); Assert.AreEqual(sequenceThree.Value, sequenceGroup.Value); Assert.True(sequenceGroup.remove(sequenceThree)); Assert.AreEqual(sequenceSeven.Value, sequenceGroup.Value); Assert.AreEqual(1, sequenceGroup.Size); }
public void ShouldSetGroupSequenceToSameValue() { var sequenceThree = new Sequence(3L); var sequenceSeven = new Sequence(7L); var sequenceGroup = new SequenceGroup(); sequenceGroup.Add(sequenceSeven); sequenceGroup.Add(sequenceThree); var expectedSequence = 11L; sequenceGroup.Value = expectedSequence; Assert.AreEqual(expectedSequence, sequenceThree.Value); Assert.AreEqual(expectedSequence, sequenceSeven.Value); }
public void ShouldReturnMaxSequenceWhenEmptyGroup() { var sequenceGroup = new SequenceGroup(); Assert.AreEqual(long.MaxValue, sequenceGroup.Value); }
public void ShouldAddWhileRunning() { var ringBuffer = RingBuffer<TestEvent>.CreateSingleProducer(() => new TestEvent(), 32); var sequenceThree = new Sequence(3L); var sequenceSeven = new Sequence(7L); var sequenceGroup = new SequenceGroup(); sequenceGroup.Add(sequenceSeven); for (int i = 0; i < 11; i++) { ringBuffer.Publish(ringBuffer.Next()); } sequenceGroup.AddWhileRunning(ringBuffer, sequenceThree); Assert.AreEqual(sequenceThree.Value,10L); }