public void WriteException_GivenException_ThrowsNoException() { try { ExceptionMiddlewareExtensions.WriteException(new Exception("Test Exception")); } catch (Exception ex) { Assert.True(false, $"Executing WriteException method should not return an exception. Exception Type {ex.GetType().ToString()} with message '{ex.Message}' caught."); } }
public void WriteException_GivenNullException_ThrowsNoException() { var mockConfiguration = Substitute.For <IConfiguration>(); try { ExceptionMiddlewareExtensions.WriteException(null); } catch (Exception ex) { Assert.True(false, $"Executing WriteException method with null exception should not return an exception. Exception Type {ex.GetType().ToString()} with message '{ex.Message}' caught."); } Assert.True(true, $"Executing WriteException method with null exception should not return an exception."); }