dividebyzeroexception

Is there any reason to throw a DivideByZeroException?

Are there any cases when it's a good idea to throw errors that can be avoided? I'm thinking specifically of the DivideByZeroException and ArgumentNullException For example: double numerator = 10; double denominator = getDenominator(); if( denominator == 0 ){ throw new DivideByZeroException("You can't divide by Zero!"); } Are the...

Zero division does not throw exception in nunit

Running the following C# code through NUnit yields Test.ControllerTest.TestSanity: Expected: `<System.DivideByZeroException>` But was: null So either no DivideByZeroException is thrown, or NUnit does not catch it. Similar to this question, but the answers he got, do not seem to work for me. This is using NUnit 2.5.5.10112, and .NET ...