Exemplo n.º 1
0
        public virtual IBeanDefinitionCollection UnityAddonEfBeans()
        {
            IBeanDefinitionCollection col = new BeanDefinitionCollection();

            col.AddFromComponentScanner(Assembly.GetExecutingAssembly(), "UnityAddon.Ef");

            return(col);
        }
Exemplo n.º 2
0
        public virtual IBeanDefinitionCollection EnableUnityAddonHangfire()
        {
            IBeanDefinitionCollection col = new BeanDefinitionCollection();

            col.AddFromComponentScanner(Assembly.GetExecutingAssembly(), "UnityAddon.Hangfire");

            return(col);
        }
Exemplo n.º 3
0
        public void ScanComponents()
        {
            IBeanDefinitionCollection defCol = new BeanDefinitionCollection();

            defCol.AddFromComponentScanner(GetType().Assembly, GetType().Namespace);

            Assert.NotNull(defCol.Where(def => def.Type == typeof(Service)).Single());
            Assert.NotNull(defCol.Where(def => def.Type == typeof(Config)).Single());
            Assert.Equal(2, defCol.Count());
        }
Exemplo n.º 4
0
        public virtual IBeanDefinitionCollection ComponentScan(UnityAddonTest testcase, [Dependency("Namespaces")] string[] namespaces)
        {
            IBeanDefinitionCollection col = new BeanDefinitionCollection();

            var nsmerge = new[] { testcase.GetType().Namespace }.Union(namespaces).ToArray();

            col.AddFromComponentScanner(testcase.GetType().Assembly, nsmerge);

            return(col);
        }
Exemplo n.º 5
0
        public virtual IBeanDefinitionCollection EnableUnityAddonCache()
        {
            IBeanDefinitionCollection col = new BeanDefinitionCollection();

            col.AddFromComponentScanner(Assembly.GetExecutingAssembly(), "UnityAddon.Cache");
            col.AddFromServiceCollection(config =>
            {
                config.AddMemoryCache();
            });

            return(col);
        }