public static void ConfiguringSetterWithNull( Exception exception) { "When assignment of a property is configured using a null expression" .x(() => exception = Record.Exception(() => A.CallToSet<int>(null))); "Then an argument null exception is thrown" .x(() => exception.Should().BeAnExceptionOfType<ArgumentNullException>()); "And the parameter name is 'propertySpecification'" .x(() => exception.As<ArgumentNullException>().ParamName.Should().Be("propertySpecification")); }
public void ReadException(Exception exception) { if (exception is AggregateException) { ExceptionText = exception.As<AggregateException>() .InnerExceptions.Select(x => x.ToString()) .Join(ExceptionSeparator); } else { ExceptionText = exception.ToString(); } }
protected void ReportException(Exception exception) { if (exception is SocketException) { var ex = exception.As<SocketException>(); SendUpstream(new SocketClosedEvent(_localEndPoint, _remoteEndPoint, ex.SocketErrorCode)); return; } SendUpstream(new ExceptionEvent(exception)); }