public async Task DoesNotSerializeExceptionOnTracingDisabled() { // No listeners ResourceThrottleRetryPolicy policy = new ResourceThrottleRetryPolicy(0); CustomException exception = new CustomException(); await policy.ShouldRetryAsync(exception, default); Assert.AreEqual(0, exception.ToStringCount, "Exception was serialized"); }
public async Task DoesSerializeExceptionOnTracingEnabled() { // Let the default trace listener DefaultTrace.TraceSource.Switch = new SourceSwitch("ClientSwitch", "Error"); DefaultTrace.TraceSource.Listeners.Add(new DefaultTraceListener()); ResourceThrottleRetryPolicy policy = new ResourceThrottleRetryPolicy(0); CustomException exception = new CustomException(); await policy.ShouldRetryAsync(exception, default); Assert.AreEqual(1, exception.ToStringCount, "Exception was not serialized"); }