public void CanStartWithOptions() { transfer.SetState(new StartIncomingWrite(new TransferOption[] { new TransferOption("blksize", "999") })); Assert.AreEqual(999, transfer.BlockSize); transfer.Start(new MemoryStream(new byte[50000])); OptionAcknowledgement cmd = (OptionAcknowledgement)transfer.SentCommands.Last(); cmd.Options.Contains(new TransferOption("blksize", "999")); Assert.IsInstanceOf <SendOptionAcknowledgementForWriteRequest>(transfer.State); }
public void TimeoutWhenNoAnswerIsReceivedAndRetryCountIsExceeded() { TransferStub transferWithLowTimeout = new TransferStub(new MemoryStream(new byte[5000])); transferWithLowTimeout.RetryTimeout = new TimeSpan(0); transferWithLowTimeout.RetryCount = 1; transferWithLowTimeout.SetState(new Sending()); transferWithLowTimeout.OnTimer(); Assert.IsFalse(transferWithLowTimeout.HadNetworkTimeout); transferWithLowTimeout.OnTimer(); Assert.IsTrue(transferWithLowTimeout.HadNetworkTimeout); }
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))); }
public void Setup() { transfer = new TransferStub(); transfer.SetState(new StartOutgoingWrite()); }
public void Setup() { transfer = new TransferStub(); transfer.SetState(new StartIncomingWrite(new TransferOption[0])); }
public void Setup() { transfer = new TransferStub(new MemoryStream(new byte[5000])); transfer.SetState(new Sending()); }
public void Setup() { ms = new MemoryStream(); transfer = new TransferStub(ms); transfer.SetState(new Receiving()); }
private void SetupTransferThatWillWrapAroundBlockCount() { transfer = new TransferStub(new MemoryStream(new byte[70000])); transfer.BlockSize = 1; transfer.SetState(new Sending()); }