public void ClearEmpty()
            {
                // Arrange
                var builder = new BinaryArray.Builder();

                // Act
                var actualReturnValue = builder.Clear();

                // Assert
                Assert.NotNull(actualReturnValue);
                Assert.Equal(builder, actualReturnValue);
                Assert.Equal(0, builder.Length);
                var array = builder.Build(_allocator);

                Assert.Equal(0, array.Length);
            }
            public void AppendRangeArraysAfterClear(byte[][] initialContents, byte[][] byteArrays)
            {
                // Arrange
                var builder = new BinaryArray.Builder();

                if (initialContents.Length > 0)
                {
                    builder.AppendRange(initialContents);
                }
                builder.Clear();
                var expectedArrayContents = byteArrays;

                // Act
                var actualReturnValue = builder.AppendRange(byteArrays);

                // Assert
                Assert.Equal(builder, actualReturnValue);
                Assert.Equal(byteArrays.Length, builder.Length);
                var actualArray = builder.Build(_allocator);

                AssertArrayContents(expectedArrayContents, actualArray);
            }
            public void AppendEnumerableAfterClear(byte[][] initialContents, byte[] bytes)
            {
                // Arrange
                var builder = new BinaryArray.Builder();

                if (initialContents.Length > 0)
                {
                    builder.AppendRange(initialContents);
                }
                builder.Clear();
                var enumerable            = (IEnumerable <byte>)bytes;
                var expectedArrayContents = new[] { bytes };

                // Act
                var actualReturnValue = builder.Append(enumerable);

                // Assert
                Assert.Equal(builder, actualReturnValue);
                Assert.Equal(1, builder.Length);
                var actualArray = builder.Build(_allocator);

                AssertArrayContents(expectedArrayContents, actualArray);
            }