Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
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)));
        }
 public void Setup()
 {
     transfer = new TransferStub();
     transfer.SetState(new StartOutgoingWrite());
 }
Exemple #5
0
 public void Setup()
 {
     transfer = new TransferStub();
     transfer.SetState(new StartIncomingWrite(new TransferOption[0]));
 }
Exemple #6
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());
 }
Exemple #8
0
 private void SetupTransferThatWillWrapAroundBlockCount()
 {
     transfer           = new TransferStub(new MemoryStream(new byte[70000]));
     transfer.BlockSize = 1;
     transfer.SetState(new Sending());
 }