`var y = homer.Salary / denominator;`
should not throw but threw
System.DivideByZeroException
with message
"Attempted to divide by zero."
ShouldNotThrow Action Extension
var homer = new Person { Name = "Homer", Salary = 30000 };
var denominator = 0;
var action = () =>
{
var y = homer.Salary / denominator;
};
action.ShouldNotThrow();
`func()`
should not throw but threw
System.ArgumentNullException
with message
"Value cannot be null. (Parameter 'name')"
ShouldNotThrowFuncOfTask
var homer = new Person { Name = "Homer", Salary = 30000 };
var denominator = 0;
Should.NotThrow(() =>
{
var task = Task.Factory.StartNew(
() =>
{
var y = homer.Salary / denominator;
});
return task;
});
`var task = Task.Factory.StartNew( () => { var y = homer.Salary / denominator; }); return task;`
should not throw but threw
System.DivideByZeroException
with message
"Attempted to divide by zero."