public void ShouldCorrectlyReportSize() { ICollection<MarketSnapshot> snapshots = new List<MarketSnapshot>(); Buffer = CreateBuffer(2); Assert.AreEqual(0, Buffer.Size()); Assert.True(Buffer.IsEmpty()); Assert.False(Buffer.IsFull()); Buffer.Offer(BpSnapshot); Assert.AreEqual(1, Buffer.Size()); Assert.False(Buffer.IsEmpty()); Assert.False(Buffer.IsFull()); Buffer.Offer(VodSnapshot1.GetInstrumentId(), VodSnapshot1); Assert.AreEqual(2, Buffer.Size()); Assert.False(Buffer.IsEmpty()); Assert.True(Buffer.IsFull()); Buffer.Poll(snapshots, 1); Assert.AreEqual(1, Buffer.Size()); Assert.False(Buffer.IsEmpty()); Assert.False(Buffer.IsFull()); Buffer.Poll(snapshots, 1); Assert.AreEqual(0, Buffer.Size()); Assert.True(Buffer.IsEmpty()); Assert.False(Buffer.IsFull()); }
public void ShouldCorrectlyReportSize() { ICollection <MarketSnapshot> snapshots = new List <MarketSnapshot>(); Buffer = CreateBuffer(2); Assert.AreEqual(0, Buffer.Size()); Assert.True(Buffer.IsEmpty()); Assert.False(Buffer.IsFull()); Buffer.Offer(BpSnapshot); Assert.AreEqual(1, Buffer.Size()); Assert.False(Buffer.IsEmpty()); Assert.False(Buffer.IsFull()); Buffer.Offer(VodSnapshot1.GetInstrumentId(), VodSnapshot1); Assert.AreEqual(2, Buffer.Size()); Assert.False(Buffer.IsEmpty()); Assert.True(Buffer.IsFull()); Buffer.Poll(snapshots, 1); Assert.AreEqual(1, Buffer.Size()); Assert.False(Buffer.IsEmpty()); Assert.False(Buffer.IsFull()); Buffer.Poll(snapshots, 1); Assert.AreEqual(0, Buffer.Size()); Assert.True(Buffer.IsEmpty()); Assert.False(Buffer.IsFull()); }
public Consumer(ICoalescingBuffer <long, MarketSnapshot> buffer, int numberOfInstruments, MarketSnapshot poisonPill, StopWatch stopWatch) { _buffer = buffer; _numberOfInstruments = numberOfInstruments; _poisonPill = poisonPill; _stopWatch = stopWatch; LatestSnapshots = new MarketSnapshot[numberOfInstruments]; }
public Consumer(ICoalescingBuffer<long, MarketSnapshot> buffer, int numberOfInstruments, MarketSnapshot poisonPill, StopWatch stopWatch) { _buffer = buffer; _numberOfInstruments = numberOfInstruments; _poisonPill = poisonPill; _stopWatch = stopWatch; LatestSnapshots = new MarketSnapshot[numberOfInstruments]; }
public void ShouldAcceptNewCollapsibleValueWhenFull() { Buffer = CreateBuffer(2); Buffer.Offer(1L, BpSnapshot); Buffer.Offer(2L, BpSnapshot); Assert.True(Buffer.Offer(2L, BpSnapshot)); Assert.AreEqual(2, Buffer.Size()); }
public void ShouldRejectNewCollapsibleValueWhenFull() { Buffer = CreateBuffer(2); Buffer.Offer(1L, BpSnapshot); Buffer.Offer(2L, VodSnapshot1); Assert.False(Buffer.Offer(4L, VodSnapshot2)); Assert.AreEqual(2, Buffer.Size()); }
public Producer(ICoalescingBuffer <long, MarketSnapshot> buffer, int numberOfInstruments, long numberOfUpdates, MarketSnapshot poisonPill, StopWatch stopWatch) { _buffer = buffer; _numberOfInstruments = numberOfInstruments; _numberOfUpdates = numberOfUpdates; _poisonPill = poisonPill; _stopWatch = stopWatch; _snapshots = CreateSnapshots(numberOfInstruments); }
public void ShouldRejectNonCollapsibleValueWhenFull() { Buffer = CreateBuffer(2); Buffer.Offer(BpSnapshot); Buffer.Offer(BpSnapshot); Assert.False(Buffer.Offer(BpSnapshot)); Assert.AreEqual(2, Buffer.Size()); }
public Producer(ICoalescingBuffer<long, MarketSnapshot> buffer, int numberOfInstruments, long numberOfUpdates, MarketSnapshot poisonPill, StopWatch stopWatch) { _buffer = buffer; _numberOfInstruments = numberOfInstruments; _numberOfUpdates = numberOfUpdates; _poisonPill = poisonPill; _stopWatch = stopWatch; _snapshots = CreateSnapshots(numberOfInstruments); }
private void CheckCapacity(int capacity, ICoalescingBuffer <long, MarketSnapshot> buffer) { Assert.AreEqual(capacity, buffer.Capacity()); for (int i = 0; i < capacity; i++) { bool success = buffer.Offer(MarketSnapshot.CreateMarketSnapshot(i, i, i)); Assert.True(success); } }
public void BeforeEveryTest() { Buffer = CreateBuffer(10); }
public PerformanceTest(ICoalescingBuffer <long, MarketSnapshot> buffer, long numberOfUpdates) { _buffer = buffer; _numberOfUpdates = numberOfUpdates; }
public Producer(ICoalescingBuffer<long, MarketSnapshot> snapshotBuffer) { _snapshotBuffer = snapshotBuffer; }
public Consumer(ICoalescingBuffer <long, MarketSnapshot> snapshotBuffer) { _snapshotBuffer = snapshotBuffer; }
public Producer(ICoalescingBuffer <long, MarketSnapshot> snapshotBuffer) { _snapshotBuffer = snapshotBuffer; }
private void CheckCapacity(int capacity, ICoalescingBuffer<long, MarketSnapshot> buffer) { Assert.AreEqual(capacity, buffer.Capacity()); for (int i = 0; i < capacity; i++) { bool success = buffer.Offer(MarketSnapshot.CreateMarketSnapshot(i, i, i)); Assert.True(success); } }
public Consumer(ICoalescingBuffer<long, MarketSnapshot> snapshotBuffer) { _snapshotBuffer = snapshotBuffer; }
public PerformanceTest(ICoalescingBuffer<long, MarketSnapshot> buffer, long numberOfUpdates) { _buffer = buffer; _numberOfUpdates = numberOfUpdates; }