public Pop3ReplayStream (IList<Pop3ReplayCommand> commands, bool testUnixFormat) { stream = GetResourceStream (commands[0].Resource); state = Pop3ReplayState.SendResponse; this.testUnixFormat = testUnixFormat; this.commands = commands; }
public Pop3ReplayStream(IList <Pop3ReplayCommand> commands, bool testUnixFormat) { stream = GetResourceStream(commands[0].Resource); state = Pop3ReplayState.SendResponse; this.testUnixFormat = testUnixFormat; this.commands = commands; }
public override void Write(byte[] buffer, int offset, int count) { CheckDisposed(); if (asyncIO) { Assert.IsTrue(isAsync, "Trying to Write in an async unit test."); } else { Assert.IsFalse(isAsync, "Trying to WriteAsync in a non-async unit test."); } Assert.AreEqual(Pop3ReplayState.WaitForCommand, state, "Trying to write when a command has already been given."); var command = Encoding.UTF8.GetString(buffer, offset, count); Assert.AreEqual(commands[index].Command, command, "Commands did not match."); if (stream != null) { stream.Dispose(); } stream = GetResourceStream(commands[index].Resource); state = Pop3ReplayState.SendResponse; }
public override int Read(byte[] buffer, int offset, int count) { CheckDisposed(); if (asyncIO) { Assert.IsTrue(isAsync, "Trying to Read in an async unit test."); } else { Assert.IsFalse(isAsync, "Trying to ReadAsync in a non-async unit test."); } Assert.AreEqual(Pop3ReplayState.SendResponse, state, "Trying to read when no command given."); Assert.IsNotNull(stream, "Trying to read when no data available."); int nread = stream.Read(buffer, offset, 1); if (stream.Position == stream.Length) { state = Pop3ReplayState.WaitForCommand; index++; } return(nread); }
public override int Read(byte[] buffer, int offset, int count) { CheckDisposed(); Assert.AreEqual(Pop3ReplayState.SendResponse, state, "Trying to read when no command given."); Assert.IsNotNull(stream, "Trying to read when no data available."); int nread = stream.Read(buffer, offset, count); if (stream.Position == stream.Length) { state = Pop3ReplayState.WaitForCommand; index++; } return(nread); }
public override void Write (byte[] buffer, int offset, int count) { CheckDisposed (); Assert.AreEqual (Pop3ReplayState.WaitForCommand, state, "Trying to write when a command has already been given."); var command = Encoding.UTF8.GetString (buffer, offset, count); Assert.AreEqual (commands[index].Command, command, "Commands did not match."); if (stream != null) stream.Dispose (); stream = GetResourceStream (commands[index].Resource); state = Pop3ReplayState.SendResponse; }
public override int Read (byte[] buffer, int offset, int count) { CheckDisposed (); Assert.AreEqual (Pop3ReplayState.SendResponse, state, "Trying to read when no command given."); Assert.IsNotNull (stream, "Trying to read when no data available."); int nread = stream.Read (buffer, offset, count); if (stream.Position == stream.Length) { state = Pop3ReplayState.WaitForCommand; index++; } return nread; }