Beispiel #1
0
        public void All_and_only_controllers_live_in_Controllers_namespace()
        {
            var allControllers        = GetPublicClassesFromApplicationAssembly(c => c.Namespace.Contains("Controllers"));
            var registeredControllers = InstallerTestHelper.GetImplementationTypesFor(typeof(IController), containerWithControllers);

            Assert.AreEqual(allControllers, registeredControllers);
        }
Beispiel #2
0
        public void All_and_only_controllers_have_Controllers_suffix()
        {
            var allControllers        = GetPublicClassesFromApplicationAssembly(c => c.Name.EndsWith("Controller"));
            var registeredControllers = InstallerTestHelper.GetImplementationTypesFor(typeof(IController), containerWithControllers);

            Assert.AreEqual(allControllers, registeredControllers);
        }
        public void All_and_only_Repositories_have_Repository_suffix()
        {
            var allRepositorys        = GetPublicClassesFromApplicationAssembly(c => c.Name.EndsWith("Repository"));
            var registeredRepositorys = InstallerTestHelper.GetImplementationTypesFor(typeof(IRepository), containerWithRepositories);

            Assert.AreEqual(allRepositorys, registeredRepositorys);
        }
        public void All_DomainServices_are_transient()
        {
            var nonTransientDomainServices = InstallerTestHelper.GetHandlersFor(typeof(IDomainService), containerWithDomainServices)
                                             .Where(DomainService => DomainService.ComponentModel.LifestyleType != LifestyleType.Transient)
                                             .ToArray();

            Assert.IsEmpty(nonTransientDomainServices);
        }
        public void All_DomainServices_implement_IDomainService()
        {
            var allHandlers           = InstallerTestHelper.GetAllHandlers(containerWithDomainServices);
            var DomainServiceHandlers = InstallerTestHelper.GetHandlersFor(typeof(IDomainService), containerWithDomainServices);

            Assert.IsNotEmpty(allHandlers);
            Assert.AreEqual(allHandlers, DomainServiceHandlers);
        }
Beispiel #6
0
        public void All_controllers_are_transient()
        {
            var nonTransientControllers = InstallerTestHelper.GetHandlersFor(typeof(IController), containerWithControllers)
                                          .Where(controller => controller.ComponentModel.LifestyleType != LifestyleType.Transient)
                                          .ToArray();

            Assert.IsEmpty(nonTransientControllers);
        }
Beispiel #7
0
        public void All_controllers_implement_IController()
        {
            var allHandlers        = InstallerTestHelper.GetAllHandlers(containerWithControllers);
            var controllerHandlers = InstallerTestHelper.GetHandlersFor(typeof(IController), containerWithControllers);

            Assert.IsNotEmpty(allHandlers);
            Assert.AreEqual(allHandlers, controllerHandlers);
        }
        public void All_Repositories_are_transient()
        {
            var nonTransientRepositorys = InstallerTestHelper.GetHandlersFor(typeof(IRepository), containerWithRepositories)
                                          .Where(Repository => Repository.ComponentModel.LifestyleType != LifestyleType.Transient)
                                          .ToArray();

            Assert.IsEmpty(nonTransientRepositorys);
        }
        public void All_DomainServices_are_registered()
        {
            // Is<TType> is an helper, extension method from Windsor
            // which behaves like 'is' keyword in C# but at a Type, not instance level
            var allDomainServices        = GetPublicClassesFromApplicationAssembly(c => c.Is <IDomainService>() && !c.IsAbstract);
            var registeredDomainServices = InstallerTestHelper.GetImplementationTypesFor(typeof(IDomainService), containerWithDomainServices);

            Assert.AreEqual(allDomainServices, registeredDomainServices);
        }
Beispiel #10
0
        public void All_controllers_are_registered()
        {
            // Is<TType> is an helper, extension method from Windsor
            // which behaves like 'is' keyword in C# but at a Type, not instance level
            var allControllers        = GetPublicClassesFromApplicationAssembly(c => c.Is <IController>());
            var registeredControllers = InstallerTestHelper.GetImplementationTypesFor(typeof(IController), containerWithControllers);

            Assert.AreEqual(allControllers, registeredControllers);
        }