today we realized that some tests where throwing exceptions but all the tests where 'pass'. In fact the exception text was shown in green.
Does this make sense?
Is there a way to make the tests fail if an exception is unhandled (I know that most of the time that happens)?
The screenshot:
The tested method:
[TestMethod]
public void CommunicationCore_CommunicationController_ConnectRequestWellProcessed()
{
// Arrange
IUnityContainer container = new UnityContainer();
ICommonInitializer initializer = new CommonInitializer(container);
initializer.Initialize(); // register all types
DriveConnection connectionSettings = CreateFakeConnetionSettings(1);
Transaction transaction = null;
ICommunicationController controller = container.Resolve<ICommunicationController>();
object locker = new object();
// Act
controller.Connect(
connectionSettings,
result =>
{
transaction = result;
lock (locker)
{
Monitor.Pulse(locker);
}
});
// asyncronous communication wait for the process of the message
lock (locker)
{
Monitor.Wait(locker, 10000);
}
// Assert
bool connectSuccessfully = (transaction != null) && !transaction.Response.ErrorResult.ErrorDetected;
Assert.IsTrue(connectSuccessfully);
((IDisposable)controller).Dispose();
}