Example #1
0
        public void ResendsPacket()
        {
            TransferStub transferWithLowTimeout = new TransferStub(new MemoryStream(new byte[5000]));

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

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

            transferWithLowTimeout.OnTimer();
            Assert.IsTrue(transferWithLowTimeout.CommandWasSent(typeof(Data)));
        }
Example #2
0
 public void CanCancel()
 {
     transfer.Cancel(TftpErrorPacket.IllegalOperation);
     Assert.IsTrue(transfer.CommandWasSent(typeof(Error)));
     Assert.IsInstanceOf <Closed>(transfer.State);
 }
Example #3
0
 public void SendsPacket()
 {
     Assert.IsTrue(transfer.CommandWasSent(typeof(Data)));
 }
Example #4
0
 public void ReceivesPacket()
 {
     transfer.OnCommand(new Data(1, new byte[100]));
     Assert.IsTrue(transfer.CommandWasSent(typeof(Acknowledgement)));
     Assert.AreEqual(100, ms.Length);
 }