public void TestRemoteInvocationException() { var mockFault = new MockFault(); var exception = new RemoteInvocationException("test", errorCode: 100, "remoteErrorData"); mockFault.SetExtraParameters(exception, emptyCallstack: false); Assert.Equal(exception.GetParameterString(), mockFault.Map[7]); }
public void TestRemoteInvocationExceptionNull() { var mockFault = new MockFault(); var exception = new RemoteInvocationException(message: null, errorCode: -1, errorData: null); mockFault.SetExtraParameters(exception, emptyCallstack: false); Assert.Equal(exception.GetParameterString(), mockFault.Map[7]); }
public void TestEmptyCallstack() { var mockFault = new MockFault(); var exception = new Exception("not thrown"); mockFault.SetExtraParameters(exception, emptyCallstack: true); Assert.NotNull(mockFault.Map[3]); }
public void TestRemoteInvocationExceptionNull() { var mockFault = new MockFault(); var exception = new RemoteInvocationException(message: null, remoteStack: null, remoteCode: null); mockFault.SetExtraParameters(exception); Assert.Equal(exception.GetParameterString(), mockFault.Map[8]); }
public void TestRemoteInvocationException() { var mockFault = new MockFault(); var exception = new RemoteInvocationException("test", "remoteCallstack", "remoteErrorCode"); mockFault.SetExtraParameters(exception); Assert.Equal(exception.GetParameterString(), mockFault.Map[8]); }
public void TestAggregateException() { try { // throw one throw new AggregateException("no inner"); } catch (Exception exception) { var mockFault = new MockFault(); mockFault.SetExtraParameters(exception, emptyCallstack: false); // there should be no extra bucket info // for regular exception Assert.False(mockFault.Map.ContainsKey(7)); } }
public void TestRegularException() { try { // throw one throw new Exception("test"); } catch (Exception exception) { var mockFault = new MockFault(); mockFault.SetExtraParameters(exception); // there should be no extra bucket info // for regular exception Assert.False(mockFault.Map.ContainsKey(8)); } }
public void TestRegularWithInnerexception() { try { try { // throw one throw new Exception("inner"); } catch (Exception inner) { throw new Exception("outter", inner); } } catch (Exception exception) { var mockFault = new MockFault(); mockFault.SetExtraParameters(exception, emptyCallstack: false); Assert.Equal(exception.InnerException.GetParameterString(), mockFault.Map[7]); } }
public void TestAggregateWithInnerexception() { try { try { // throw one throw new Exception("inner"); } catch (Exception inner) { throw new AggregateException(inner); } } catch (Exception exception) { var mockFault = new MockFault(); mockFault.SetExtraParameters(exception); Assert.Equal(exception.GetParameterString(), mockFault.Map[8]); } }
public void TestAggregateWithMultipleInnerexceptions() { try { List <Exception> inners = new List <Exception>(); try { // throw one throw new Exception("inner1"); } catch (Exception inner) { inners.Add(inner); } try { // throw one throw new Exception("inner2"); } catch (Exception inner) { inners.Add(inner); } throw new AggregateException(inners); } catch (AggregateException exception) { var mockFault = new MockFault(); mockFault.SetExtraParameters(exception, emptyCallstack: false); var flatten = exception.Flatten(); Assert.Equal(flatten.CalculateHash(), mockFault.Map[6]); Assert.Equal(flatten.InnerException.GetParameterString(), mockFault.Map[7]); } }