public void Replace() { AsciiString abcd = new AsciiString("abcd"); Assert.Equal(new AsciiString("adcd"), abcd.Replace('b', 'd')); Assert.Equal(new AsciiString("dbcd"), abcd.Replace('a', 'd')); Assert.Equal(new AsciiString("abca"), abcd.Replace('d', 'a')); Assert.Same(abcd, abcd.Replace('x', 'a')); Assert.Equal(new AsciiString("cc"), new AsciiString("abcd", 1, 2).Replace('b', 'c')); Assert.Equal(new AsciiString("bb"), new AsciiString("abcd", 1, 2).Replace('c', 'b')); Assert.Equal(new AsciiString("bddd"), new AsciiString("abcdc", 1, 4).Replace('c', 'd')); Assert.Equal(new AsciiString("xbcxd"), new AsciiString("abcada", 0, 5).Replace('a', 'x')); }
public override string ToString() { return(string.Format("{4}: {0} \t{1} \t{2} \t{3}", Convert.ToString(MachineName), HexString, AsciiString.Replace("\n", @"\n"), FieldString, OffsetFile)); }