public void ReturnedPieceIsAppendableWhileBufferHasntChanged()
		{
			var buffer = new InsertionBuffer<int>();

			var piece = buffer.Insert(42);
			Assert.IsTrue(IsAppendable(piece));
			Assert.IsTrue(IsAppendable(piece.Append(42)));
		}
Example #2
0
        public void ReturnedPieceIsAppendableWhileBufferHasntChanged()
        {
            var buffer = new InsertionBuffer <int>();

            var piece = buffer.Insert(42);

            Assert.IsTrue(IsAppendable(piece));
            Assert.IsTrue(IsAppendable(piece.Append(42)));
        }
		public void ReturnedPieceIsNoLongerAppendableAfterBufferHasChanged()
		{
			var buffer = new InsertionBuffer<int>();

			var piece = buffer.Insert(42);
			Assert.IsTrue(IsAppendable(piece));

			buffer.Insert(42);
			Assert.IsFalse(IsAppendable(piece));
		}
Example #4
0
        public void ReturnedPieceIsNoLongerAppendableAfterBufferHasChanged()
        {
            var buffer = new InsertionBuffer <int>();

            var piece = buffer.Insert(42);

            Assert.IsTrue(IsAppendable(piece));

            buffer.Insert(42);
            Assert.IsFalse(IsAppendable(piece));
        }
		public void CopyTo(int destinationLength, int destinationIndex, int sourceIndex, int length, int[] expected)
		{
			var buffer = new InsertionBuffer<int>();
			buffer.Insert(42); // some recognizable "garbage" at the beginning of the buffer

			// 1234
			var piece = buffer.Insert(1);
			for (var i = 2; i < 5; ++i)
				piece = (IAppendablePiece<int>) piece.Append(i);

			var destination = new int[destinationLength];
			piece.CopyTo(destination, destinationIndex, sourceIndex, length);
			Assert.AreEqual(expected, destination);
		}
Example #6
0
        public void CopyTo(int destinationLength, int destinationIndex, int sourceIndex, int length, int[] expected)
        {
            var buffer = new InsertionBuffer <int>();

            buffer.Insert(42);             // some recognizable "garbage" at the beginning of the buffer

            // 1234
            var piece = buffer.Insert(1);

            for (var i = 2; i < 5; ++i)
            {
                piece = (IAppendablePiece <int>)piece.Append(i);
            }

            var destination = new int[destinationLength];

            piece.CopyTo(destination, destinationIndex, sourceIndex, length);
            Assert.AreEqual(expected, destination);
        }