1
namespace Castle
.MonoRail
.Framework
.Tests
.Providers
3 using Castle
.MonoRail
.Framework
.Helpers
;
4 using Castle
.MonoRail
.Framework
.Providers
;
10 public class DefaultHelperDescriptorProviderTestCase
12 private DefaultHelperDescriptorProvider provider
= new DefaultHelperDescriptorProvider();
15 public void ShouldReturnEmptyArrayForControllerWithNoHelperAttribute()
17 HelperDescriptor
[] descs
= provider
.CollectHelpers(typeof(NoHelperController
));
18 Assert
.IsNotNull(descs
);
19 Assert
.AreEqual(0, descs
.Length
);
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
);
33 public void ShouldReturnDescriptorsForControllerWithMultiHelperAttributes()
35 HelperDescriptor
[] descs
= provider
.CollectHelpers(typeof(MultiHelperController
));
36 Assert
.IsNotNull(descs
);
37 Assert
.AreEqual(2, descs
.Length
);
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