Refactored the Kernel registration fluent interface to be more readable, better suppo...
[castle.git] / MonoRail / Castle.MonoRail.Framework.Tests / Providers / DefaultHelperDescriptorProviderTestCase.cs
blob1d39562ff9ff3bce262c2b245c985a72ccbd70ed
1 namespace Castle.MonoRail.Framework.Tests.Providers
3 using Castle.MonoRail.Framework.Helpers;
4 using Castle.MonoRail.Framework.Providers;
5 using Descriptors;
6 using Helpers;
7 using NUnit.Framework;
9 [TestFixture]
10 public class DefaultHelperDescriptorProviderTestCase
12 private DefaultHelperDescriptorProvider provider = new DefaultHelperDescriptorProvider();
14 [Test]
15 public void ShouldReturnEmptyArrayForControllerWithNoHelperAttribute()
17 HelperDescriptor[] descs = provider.CollectHelpers(typeof(NoHelperController));
18 Assert.IsNotNull(descs);
19 Assert.AreEqual(0, descs.Length);
22 [Test]
23 public void ShouldReturnSingleDescriptorForControllerWithAHelperAttribute()
25 HelperDescriptor[] descs = provider.CollectHelpers(typeof(SingleHelperController));
26 Assert.IsNotNull(descs);
27 Assert.AreEqual(1, descs.Length);
28 Assert.AreEqual(typeof(DummyHelper), descs[0].HelperType);
29 Assert.AreEqual("abc", descs[0].Name);
32 [Test]
33 public void ShouldReturnDescriptorsForControllerWithMultiHelperAttributes()
35 HelperDescriptor[] descs = provider.CollectHelpers(typeof(MultiHelperController));
36 Assert.IsNotNull(descs);
37 Assert.AreEqual(2, descs.Length);
40 #region Controllers
42 public class NoHelperController : Controller
46 [Helper(typeof(DummyHelper), "abc")]
47 public class SingleHelperController : Controller
51 [Helper(typeof(DummyHelper))]
52 [Helper(typeof(DummyHelper))]
53 public class MultiHelperController : Controller
57 public class DummyHelper : AbstractHelper
62 #endregion