public void ShouldThowExceptionIfNullLinesRead() { var readLines = Substitute.For<ICommunication>(); readLines.ReadLine().Returns(string.Empty); var subjectUnderTest = new ReadUntillEndRecieved(readLines); subjectUnderTest.Next(); }
public void ShouldReadAllLinesExceptTheEndString() { var readLines = Substitute.For<ICommunication>(); readLines.ReadLine().Returns( JsonStrings.HandshakeMessageIn().First(), JsonStrings.HandshakeMessageIn().Skip(1).ToArray()); var expected = JsonStrings.HandshakeMessageIn().WithoutEnd().ToSingleString(); var subjectUnderTest = new ReadUntillEndRecieved(readLines); Assert.That(subjectUnderTest.Next(), Is.EqualTo(expected)); }