Example #1
0
        public void ResendsRequest()
        {
            TransferStub transferWithLowTimeout = new TransferStub(new MemoryStream());

            transferWithLowTimeout.RetryTimeout = new TimeSpan(0);
            transferWithLowTimeout.SetState(new SendReadRequest());

            Assert.IsTrue(transferWithLowTimeout.CommandWasSent(typeof(ReadRequest)));
            transferWithLowTimeout.SentCommands.Clear();

            transferWithLowTimeout.OnTimer();
            Assert.IsTrue(transferWithLowTimeout.CommandWasSent(typeof(ReadRequest)));
        }
Example #2
0
        public void SendsWriteRequest()
        {
            TransferStub transfer = new TransferStub(new MemoryStream(new byte[5000]));

            transfer.SetState(new SendWriteRequest());
            Assert.IsTrue(transfer.CommandWasSent(typeof(WriteRequest)));
        }
Example #3
0
 public void CanCancel()
 {
     transfer.Cancel(TftpErrorPacket.IllegalOperation);
     Assert.IsTrue(transfer.CommandWasSent(typeof(Error)));
     Assert.IsInstanceOf <Closed>(transfer.State);
 }
 public void SendsErrorToClient()
 {
     Assert.IsTrue(transfer.CommandWasSent(typeof(Error)));
 }
Example #5
0
 public void CanStart()
 {
     transfer.Start(new MemoryStream());
     Assert.IsTrue(transfer.CommandWasSent(typeof(ReadRequest)));
     Assert.IsInstanceOf <SendReadRequest>(transfer.State);
 }