コード例 #1
0
        public void AppendWithBufferGrowth_Fact()
        {
            // storage is    | _A_ | _B_ | _C_ | _D_ |
            // readIndex is  0
            // append        | _1_ | _2_ |
            // storage should become => | _A_ | _B_ | _C_ | _D_ | _1_ | _2_ |
            var mock = new MockIOBuffer(0x0a, 0x0b, 0x0c, 0x0d);

            mock.Append(1, 2);
            mock.Storage.ShouldEnumerateEqual(0x0a, 0x0b, 0x0c, 0x0d, 1, 2);
        }
コード例 #2
0
        public void AppendWithShiftingIndex_Fact()
        {
            // storage is    | _A_ | _B_ | _C_ | _D_ |
            // readIndex is  3
            // append        | _1_ | _2_ |
            // storage should become => | _A_ | _D_ | _1_ | _2_ |
            // readIndex should become 1
            var mock = new MockIOBuffer(0x0a, 0x0b, 0x0c, 0x0d);

            mock.ReadIndex = 3;
            mock.Append(1, 2);
            mock.Storage.ShouldEnumerateEqual(0x0A, 0x0D, 1, 2);
            mock.ReadIndex.ShouldEqual(1);
        }