public void SetUp() { RcvBuffer = new UnsafeBuffer(new byte[ALIGNED_FRAME_LENGTH]); DataHeader = new DataHeaderFlyweight(); MockFragmentHandler = A.Fake <FragmentHandler>(); MockControlledFragmentHandler = A.Fake <IControlledFragmentHandler>(); Position = A.Fake <IPosition>(options => options.Wrapping(new AtomicLongPosition())); LogBuffers = A.Fake <LogBuffers>(); ErrorHandler = A.Fake <ErrorHandler>(); Subscription = A.Fake <Subscription>(); TermBuffers = new UnsafeBuffer[LogBufferDescriptor.PARTITION_COUNT]; DataHeader.Wrap(RcvBuffer); for (var i = 0; i < LogBufferDescriptor.PARTITION_COUNT; i++) { TermBuffers[i] = new UnsafeBuffer(new byte[TERM_BUFFER_LENGTH]); } logMetaDataBuffer = new UnsafeBuffer(new byte[LogBufferDescriptor.LOG_META_DATA_LENGTH]); A.CallTo(() => LogBuffers.TermBuffers()).Returns(TermBuffers); A.CallTo(() => LogBuffers.TermLength()).Returns(TERM_BUFFER_LENGTH); A.CallTo(() => LogBuffers.MetaDataBuffer()).Returns(logMetaDataBuffer); }
public void SetUp() { _sendBuffer = new byte[SendBufferCapacity]; _atomicSendBuffer = new UnsafeBuffer(_sendBuffer); _logMetaDataBuffer = new UnsafeBuffer(new byte[LogBufferDescriptor.LOG_META_DATA_LENGTH]); _termBuffers = new UnsafeBuffer[LogBufferDescriptor.PARTITION_COUNT]; _conductor = A.Fake <ClientConductor>(); _logBuffers = A.Fake <LogBuffers>(); _publicationLimit = A.Fake <IReadablePosition>(); A.CallTo(() => _publicationLimit.Volatile).Returns(2 * SendBufferCapacity); A.CallTo(() => _logBuffers.TermBuffers()).Returns(_termBuffers); A.CallTo(() => _logBuffers.TermLength()).Returns(LogBufferDescriptor.TERM_MIN_LENGTH); A.CallTo(() => _logBuffers.MetaDataBuffer()).Returns(_logMetaDataBuffer); LogBufferDescriptor.InitialTermId(_logMetaDataBuffer, TermID1); LogBufferDescriptor.TimeOfLastStatusMessage(_logMetaDataBuffer, 0); for (var i = 0; i < LogBufferDescriptor.PARTITION_COUNT; i++) { _termBuffers[i] = new UnsafeBuffer(new byte[LogBufferDescriptor.TERM_MIN_LENGTH]); } _publication = new Publication(_conductor, Channel, StreamID1, SessionID1, _publicationLimit, _logBuffers, CorrelationID); _publication.IncRef(); LogBufferDescriptor.InitialiseTailWithTermId(_logMetaDataBuffer, PartionIndex, TermID1); }