コード例 #1
0
ファイル: ManyToOneBufferTests.cs プロジェクト: zhangz/RampUp
        public void SetUp()
        {
            _buffer = Substitute.For <IUnsafeBuffer>();
            _buffer.Size.Returns(TotalBufferLength);

            _buffer.GetAtomicLong(Arg.Any <long>()).Returns(ci => new AtomicLong((byte *)ci.Arg <long>()));
            _buffer.GetAtomicInt(Arg.Any <long>()).Returns(ci => new AtomicInt((byte *)ci.Arg <long>()));

            _atomicLong      = Substitute.For <Mocks.IAtomicLong>();
            Mocks.AtomicLong = _atomicLong;
            _atomicInt       = Substitute.For <Mocks.IAtomicInt>();
            Mocks.AtomicInt  = _atomicInt;

            _ringBuffer = new ManyToOneRingBuffer(_buffer);
        }
コード例 #2
0
        public void SetUp()
        {
            _buffer = Substitute.For<IUnsafeBuffer>();
            _buffer.Size.Returns(TotalBufferLength);

            _buffer.GetAtomicLong(Arg.Any<long>()).Returns(ci => new AtomicLong((byte*) ci.Arg<long>()));
            _buffer.GetAtomicInt(Arg.Any<long>()).Returns(ci => new AtomicInt((byte*) ci.Arg<long>()));

            _atomicLong = Substitute.For<Mocks.IAtomicLong>();
            Mocks.AtomicLong = _atomicLong;
            _atomicInt = Substitute.For<Mocks.IAtomicInt>();
            Mocks.AtomicInt = _atomicInt;

            _ringBuffer = new OneToOneRingBuffer(_buffer);
        }