public void Should_Not_Find_Is_Module_Registered_By_AreaName()
        {
            var service = new DefaultWebModulesRegistration(new Mock<IAssemblyLoader>().Object, new Mock<IControllerExtensions>().Object);
            var isRegisteted = service.IsModuleRegisteredByAreaName("Test");

            Assert.IsFalse(isRegisteted);
        }
        public void Should_Not_Find_Module_By_AreaName()
        {
            var service = new DefaultWebModulesRegistration(new Mock<IAssemblyLoader>().Object, new Mock<IControllerExtensions>().Object);
            var descriptor = service.FindModuleByAreaName("Test");

            Assert.IsNull(descriptor);
        }
        public void Should_Find_Is_Module_Registered_By_AreaName()
        {
            var loader = new Mock<IAssemblyLoader>();
            loader
                .Setup(l => l.GetLoadableTypes(It.IsAny<Assembly>()))
                .Returns<Assembly>(r => new[] { typeof(SampleWebModuleDescriptor) });

            var service = new DefaultWebModulesRegistration(loader.Object, new Mock<IControllerExtensions>().Object);
            service.AddModuleDescriptorTypeFromAssembly(GetType().Assembly);
            service.InitializeModules();

            var sampleDescriptor = new SampleWebModuleDescriptor();

            var isRegisteted = service.IsModuleRegisteredByAreaName(sampleDescriptor.AreaName);
            Assert.IsTrue(isRegisteted);
        }
        public void Should_Register_Route_Correctly()
        {
            var loader = new Mock<IAssemblyLoader>();
            loader
                .Setup(l => l.GetLoadableTypes(It.IsAny<Assembly>()))
                .Returns<Assembly>(r => new[] { typeof(SampleWebModuleDescriptor) });

            var service = new DefaultWebModulesRegistration(loader.Object, new Mock<IControllerExtensions>().Object);
            service.AddModuleDescriptorTypeFromAssembly(GetType().Assembly);
            service.InitializeModules();

            var routes = new RouteCollection();
            service.RegisterKnownModuleRoutes(routes);

            Assert.IsNotEmpty(routes);
            Assert.IsTrue(routes.Any(r => ((Route)r).Url == "module-bettermoduleswebsample/{controller}/{action}"));
        }