using System; using System.Threading; using Caliburn.Metadata; using MbUnit.Framework; namespace Tests.Caliburn.The_core_framework_can { [TestFixture(ApartmentState = ApartmentState.STA)] public class by_using_PresenterInfo { private readonly Type presenterType = typeof(TestPresenter); [Test] public void find_an_action_by_name() { string methodName = "TestAction"; PresenterInfo info = PresenterInfo.Create(presenterType); ActionInfo actionInfo = info.FindAction(methodName); Assert.IsNotNull(actionInfo); Assert.AreEqual(methodName, actionInfo.Name); Assert.AreEqual(info, actionInfo.Owner); } [Test] public void perform_a_rescue() { PresenterInfo info = PresenterInfo.Create(presenterType); TestPresenter presenter = new TestPresenter(); info.PerformRescue(presenter, new Exception()); Assert.IsTrue(presenter.PresenterRescueCalled); } } }