public void IsEndOfLine_WithNonMarker_ShouldReturnNull(int position) { var data = new byte[] { 0x00, Character.LineFeed, 0x00, Character.CarriageReturn, Character.LineFeed, 0x00 }; var subject = new BinaryString(data); subject.IsEndOfLine(position).Should().BeNull(); }
public void IsEndOfLine_WithSingleCarriageReturn_ShouldIdentifyAsCarriageReturn(int length, int position) { // Arrange. var data = new byte[length]; if (position > 0) { data[position - 1] = Character.LineFeed; } data[position] = Character.CarriageReturn; var subject = new BinaryString(data); // Assert. subject.IsEndOfLine(position).Should().Be(EndOfLine.CarriageReturn); }
public void IsEndOfLine_WithBoth_ShouldIdentifyAsBoth(int length, int position) { // Arrange. var data = new byte[length]; if (position > 0) { data[position - 1] = Character.LineFeed; } data[position + 0] = Character.CarriageReturn; data[position + 1] = Character.LineFeed; if (position + 2 < data.Length) { data[position + 2] = Character.LineFeed; } var subject = new BinaryString(data); // Assert. subject.IsEndOfLine(position).Should().Be(EndOfLine.Both); }