Esempio n. 1
0
        public void Defaults()
        {
            Assert.Throws <ArgumentNullException>(() => HexDump.Format(null));

            Assert.Equal("", HexDump.Format(ByteSequence('a', 0)));

            Assert.Equal("0000    61 62 63 64 65 66                                   abcdef           ", HexDump.Format(ByteSequence('a', 6)));
            Assert.Equal("0000    61 62 63 64 65 66 67 68  69 6A 6B 6C 6D 6E 6F 70    abcdefgh ijklmnop", HexDump.Format(ByteSequence('a', 16)));

            Assert.Equal(
                "0000    61 62 63 64 65 66 67 68  69 6A 6B 6C 6D 6E 6F 70    abcdefgh ijklmnop" + Environment.NewLine +
                "0010    71 72 73 74 75 76 77 78  79 7A                      qrstuvwx yz      ",
                HexDump.Format(ByteSequence('a', 26)));

            Assert.Equal(
                "0000    61 62 63 64 65 66 67 68  69 6A 6B 6C 6D 6E 6F 70" + Environment.NewLine +
                "0010    71 72 73 74 75 76 77 78  79 7A                  ",
                HexDump.Format(ByteSequence('a', 26), includeAscii: false));

            Assert.Equal(
                "61 62 63 64 65 66 67 68  69 6A 6B 6C 6D 6E 6F 70    abcdefgh ijklmnop" + Environment.NewLine +
                "71 72 73 74 75 76 77 78  79 7A                      qrstuvwx yz      ",
                HexDump.Format(ByteSequence('a', 26), includeOffset: false));

            Assert.Equal(
                "61 62 63 64 65 66 67 68  69 6A 6B 6C 6D 6E 6F 70" + Environment.NewLine +
                "71 72 73 74 75 76 77 78  79 7A                  ",
                HexDump.Format(ByteSequence('a', 26), includeOffset: false, includeAscii: false));
        }