示例#1
0
        public void Controller_Not_Static()
        {
            var host = new CliControllerHost();

            Assert.Throws <ArgumentException>(() =>
            {
                host.RegisterController(typeof(StaticController));
            });
        }
示例#2
0
        public void Controller_Not_Abstract()
        {
            var host = new CliControllerHost();

            Assert.Throws <ArgumentException>(() =>
            {
                host.RegisterController <AbstractController>();
            });
        }
示例#3
0
        public void Get_Registered_Controllers()
        {
            var host = new CliControllerHost();

            host.RegisterController <ExampleControllerA>();
            host.RegisterController <ExampleControllerB>();

            Type[] expectedControllers = new[] { typeof(ExampleControllerA),
                                                 typeof(ExampleControllerB) };
            Type[] controllers = host.Controllers.OrderBy(x => x.Name)
                                 .ToArray();
            Assert.Equal(expectedControllers, controllers);
        }