Hi there,
I am trying to mock the InnerException-Property of a Mocked SqlException.
I will be grateful for any help.
Normen
I am trying to mock the InnerException-Property of a Mocked SqlException.
[Test]
public
void
SqlException_Example()
{
var sqlEx = Mock.Create<SqlException>();
sqlEx.Arrange(ex => ex.Class).Returns(20);
sqlEx.Arrange(ex => ex.InnerException).Returns(
new
Exception(
"My Test"
));
Assert.IsTrue(Mock.IsProfilerEnabled);
Assert.That(sqlEx.Class, Is.EqualTo(20));
Assert.That(sqlEx.InnerException, Is.Not.Null);
//<-- Fails
}
I will be grateful for any help.
Normen