Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPrintUserSpecifiedLineNumberFormat()
        public virtual void ShouldPrintUserSpecifiedLineNumberFormat()
        {
            // GIVEN
            MemoryStream outStream = new MemoryStream();
            PrintStream  @out      = new PrintStream(outStream);
            HexPrinter   printer   = (new HexPrinter(@out)).WithLineNumberFormat(5, "[", "]");

            // WHEN
            for (sbyte value = 0; value < 40; value++)
            {
                printer.Append(value);
            }

            // THEN
            @out.flush();
            assertEquals(format("[0x00000]" + "00 01 02 03 04 05 06 07    08 09 0A 0B 0C 0D 0E 0F    " + "10 11 12 13 14 15 16 17    18 19 1A 1B 1C 1D 1E 1F%n" + "[0x00001]" + "20 21 22 23 24 25 26 27"), outStream.ToString());
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotGroupingWhenBytesPerGroupIsGreaterThanBytesPerLine()
        public virtual void ShouldNotGroupingWhenBytesPerGroupIsGreaterThanBytesPerLine()
        {
            // GIVEN
            MemoryStream outStream = new MemoryStream();
            PrintStream  @out      = new PrintStream(outStream);
            HexPrinter   printer   = (new HexPrinter(@out)).WithBytesPerLine(12).withBytesPerGroup(100);

            // WHEN
            for (sbyte value = 0; value < 30; value++)
            {
                printer.Append(value);
            }

            // THEN
            @out.flush();
            assertEquals(format("00 01 02 03 04 05 06 07 08 09 0A 0B%n" + "0C 0D 0E 0F 10 11 12 13 14 15 16 17%n" + "18 19 1A 1B 1C 1D"), outStream.ToString());
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPrintACoupleOfLines()
        public virtual void ShouldPrintACoupleOfLines()
        {
            // GIVEN
            MemoryStream outStream = new MemoryStream();
            PrintStream  @out      = new PrintStream(outStream);
            HexPrinter   printer   = new HexPrinter(@out);

            // WHEN
            for (sbyte value = 0; value < 40; value++)
            {
                printer.Append(value);
            }

            // THEN
            @out.flush();
            assertEquals(format("00 01 02 03 04 05 06 07    08 09 0A 0B 0C 0D 0E 0F    " + "10 11 12 13 14 15 16 17    18 19 1A 1B 1C 1D 1E 1F%n" + "20 21 22 23 24 25 26 27"), outStream.ToString());
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPrintUserSpecifiedBytesGroupingFormat()
        public virtual void ShouldPrintUserSpecifiedBytesGroupingFormat()
        {
            // GIVEN
            MemoryStream outStream = new MemoryStream();
            PrintStream  @out      = new PrintStream(outStream);
            HexPrinter   printer   = (new HexPrinter(@out)).WithBytesGroupingFormat(12, 4, ", ");

            // WHEN
            for (sbyte value = 0; value < 30; value++)
            {
                printer.Append(value);
            }

            // THEN
            @out.flush();
            assertEquals(format("00 01 02 03, 04 05 06 07, 08 09 0A 0B%n" + "0C 0D 0E 0F, 10 11 12 13, 14 15 16 17%n" + "18 19 1A 1B, 1C 1D"), outStream.ToString());
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldStartFromUserSpecifiedLineNumber()
        public virtual void ShouldStartFromUserSpecifiedLineNumber()
        {
            // GIVEN
            MemoryStream outStream = new MemoryStream();
            PrintStream  @out      = new PrintStream(outStream);
            HexPrinter   printer   = (new HexPrinter(@out)).WithLineNumberDigits(2).withLineNumberOffset(0xA8);

            // WHEN
            for (sbyte value = 0; value < 40; value++)
            {
                printer.Append(value);
            }

            // THEN
            @out.flush();
            assertEquals(format("@ 0xA8: " + "00 01 02 03 04 05 06 07    08 09 0A 0B 0C 0D 0E 0F    " + "10 11 12 13 14 15 16 17    18 19 1A 1B 1C 1D 1E 1F%n" + "@ 0xA9: " + "20 21 22 23 24 25 26 27"), outStream.ToString());
        }