public static string ToHexString(this IReadOnlyList <Bit> @this)
        {
            char[] chars = new char[@this.Count / 4 + 2];

            ByteWriter bw = new ByteWriter();

            for (int n = 0; n < @this.Count;)
            {
                for (int j = 0; j < 4; j++)
                {
                    bw.AddBit(@this[n++]);
                }
                chars[chars.Length - n / 4] = ConversionTool.ToHexSymbol(bw.Value);
                bw.Reset();
            }
            chars[0] = '0';
            chars[1] = 'x';
            return(new string(chars));
        }
 public void AddBitGuardTest()
 {
     for (int n = 0; n < 8; n++)
     {
         writer.AddBit(Bit.Zero);
     }
     Assert.Throws <InvalidOperationException>(() => writer.AddBit(Bit.Zero));
 }