public void CallsTrace() { TftpTrace.Enabled = true; Assert.IsFalse(listener.WriteWasCalled); TftpTrace.Trace("Test", new TransferStub()); Assert.IsTrue(listener.WriteWasCalled); }
public void DoesNotWriteWhenDisabled() { TftpTrace.Enabled = false; TftpTrace.Trace("Test", new TransferStub()); Assert.IsFalse(listener.WriteWasCalled); TftpTrace.Enabled = true; }
private void timer_OnTimer(object context) { try { lock (this) { state.OnTimer(); } } catch (Exception e) { TftpTrace.Trace("Ignoring unhandled exception: " + e, this); } }
public override void OnTimer() { if (timer.IsTimeout()) { TftpTrace.Trace("Network timeout.", Context); timer.Restart(); if (retriesUsed++ >= Context.RetryCount) { TftpTransferError error = new TimeoutError(Context.RetryTimeout, Context.RetryCount); Context.SetState(new ReceivedError(error)); } else { HandleTimeout(); } } }
public override void OnStateEnter() { TftpTrace.Trace("Received error: " + error, Context); Context.RaiseOnError(error); Context.SetState(new Closed()); }