コード例 #1
0
 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.");
     }
 }
コード例 #2
0
        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.");
        }