public void SendNextLine_2CallsX12_2SegmentsWritten() { //arrange const int targetNo = 4; var target = new X12DispenserForTarget(_writer, targetNo, new Lazy <string>(() => "~")); //X12 segment terminator is ~ var targetPO = new PrivateObject(target); //act target.SendNextLine("first line".ToExternalTuple(targetNo)); target.SendNextLine("second line".ToExternalTuple(targetNo)); //assert targetPO.GetField("TargetNo").Should().Be(targetNo); var writtenLines = WrittenLines.ToList(); writtenLines.Count().Should().Be(1); //both segments are in a single line writtenLines[0].Should().Be("first line~second line~"); }
public void SendNextLine_2CallsX12WithNewLines_2SegmentsWritten() { //arrange const int targetNo = 4; var target = new X12DispenserForTarget(_writer, targetNo, new Lazy <string>(() => "\r\n")); //X12 segment terminator is CRLF (in essence the same as non-X12) var targetPO = new PrivateObject(target); //act target.SendNextLine("first line".ToExternalTuple(targetNo)); target.SendNextLine("second line".ToExternalTuple(targetNo)); //assert targetPO.GetField("TargetNo").Should().Be(targetNo); var writtenLines = WrittenLines.ToList(); writtenLines.Count().Should().Be(2); writtenLines[0].Should().Be("first line"); writtenLines[1].Should().Be("second line"); }