Refactored the Kernel registration fluent interface to be more readable, better suppo...
[castle.git] / MonoRail / Castle.MonoRail.Framework.Tests / Providers / DefaultRescueDescriptorProviderTestCase.cs
blob1544b281d14b9cb56213198070d0081d2e336b64
1 namespace Castle.MonoRail.Framework.Tests.Providers
3 using System;
4 using Castle.MonoRail.Framework.Providers;
5 using Descriptors;
6 using NUnit.Framework;
8 [TestFixture]
9 public class DefaultRescueDescriptorProviderTestCase
11 private DefaultRescueDescriptorProvider provider = new DefaultRescueDescriptorProvider();
13 [Test]
14 public void CanCollectLayoutFromClass()
16 RescueDescriptor[] descs = provider.CollectRescues(typeof(RescueOnController));
18 Assert.IsNotNull(descs);
19 Assert.AreEqual(1, descs.Length);
20 Assert.AreEqual("general", descs[0].ViewName);
21 Assert.AreEqual(typeof(Exception), descs[0].ExceptionType);
24 [Test]
25 public void CanCollectLayoutFromMethod()
27 RescueDescriptor[] descs = provider.CollectRescues(typeof(RescueOnActionController).GetMethod("Action1"));
29 Assert.IsNotNull(descs);
30 Assert.AreEqual(1, descs.Length);
31 Assert.AreEqual("action", descs[0].ViewName);
32 Assert.AreEqual(typeof(ArgumentNullException), descs[0].ExceptionType);
35 #region Controllers
37 [Rescue("general")]
38 public class RescueOnController : Controller
42 public class RescueOnActionController : Controller
44 [Rescue("action", typeof(ArgumentNullException))]
45 public void Action1()
51 #endregion