private void Test(TestParameters[] tests) { PriorStudyLoaderExceptionPolicy.Reset(); var policy = new PriorStudyLoaderExceptionPolicy(); var context = new Context(); foreach (var test in tests) { //reset. context.ShowedMessageBox = false; if (test.FindFailed || !test.ResultsComplete) { var exception = test.FindFailed ? new LoadPriorStudiesException() : new LoadPriorStudiesException(test.OtherExceptions, test.StudyCount, test.ResultsComplete); PriorStudyLoaderExceptionPolicy.NotifyFailedQuery(); policy.Handle(exception, context); Assert.AreEqual(test.MessageBoxExpected, context.ShowedMessageBox); } else { PriorStudyLoaderExceptionPolicy.NotifySuccessfulQuery(); if (test.OtherExceptions.Count > 0) { var exception = new LoadPriorStudiesException(test.OtherExceptions, test.StudyCount, test.ResultsComplete); policy.Handle(exception, context); } Assert.AreEqual(test.MessageBoxExpected, context.ShowedMessageBox); } } }