Exemple #1
0
        public void Castle()
        {
            SystemConfig.ConfigFilesAssemblyName = "CodeSharp.Framework.Castles.Test";
            SystemConfig.Configure("ConfigFiles")
            .Castle()
            .BusinessDependency(Assembly.GetExecutingAssembly());

            Assert.AreEqual("abc", SystemConfig.Settings["key1"]);

            Assert.DoesNotThrow(() => DependencyResolver.Resolve <ILoggerFactory>().Create(this.GetType()).Info("hi"));

            Assert.DoesNotThrow(() => DependencyResolver.Resolve <ITestService>());

            Assert.DoesNotThrow(() => DependencyResolver.Resolve <NHibernate.ISessionFactory>());

            //NH Tests
            var e = new TestEntity("abc");
            var s = DependencyResolver.Resolve <ITestService>();

            s.Create(e);
            DependencyResolver.Resolve <Castle.Facilities.NHibernateIntegration.ISessionManager>().OpenSession().Evict(e);
            var e2 = s.Get(e.ID);

            //private setter?
            Assert.AreEqual(e.Name, e2.Name);
            Assert.AreEqual("abc", e2.Name);

            Assert.DoesNotThrow(() => SystemConfig.Cleanup());
        }
Exemple #2
0
 public override void Unload()
 {
     //停止调度
     DependencyResolver.Resolve <Taobao.Workflow.Activities.Hosting.IScheduler>().Stop();
     SystemConfig.Cleanup();
 }
Exemple #3
0
 public override void Unload()
 {
     SystemConfig.Cleanup();
 }