Example #1
0
        public void TestFixtureSetUp()
        {
            try
            {
                CodeSharp.Core.Configuration.ConfigWithEmbeddedXml(null
                                                                   , "application_config"
                                                                   , Assembly.GetExecutingAssembly()
                                                                   , "Cooper.Model.Test.ConfigFiles")
                .RenderProperties()
                .Castle(o => this.Resolve(o.Container));

                //初始化同步锁
                DependencyResolver.Resolve <ILockHelper>().Init <Account>();
                DependencyResolver.Resolve <ILockHelper>().Init <GoogleConnection>();
                DependencyResolver.Resolve <ILockHelper>().Init <GitHubConnection>();
                DependencyResolver.Resolve <ILockHelper>().Init <Member>();
            }
            catch (Exception e)
            {
                if (!e.Message.Contains("不可重复初始化配置"))
                {
                    Console.WriteLine(e.Message);
                    throw e;
                }
            }

            this._log            = DependencyResolver.Resolve <ILoggerFactory>().Create(this.GetType());
            this._sessionManager = DependencyResolver.Resolve <Castle.Facilities.NHibernateIntegration.ISessionManager>();

            this._accountHelper            = DependencyResolver.Resolve <IAccountHelper>();
            this._accountService           = DependencyResolver.Resolve <IAccountService>();
            this._accountConnectionService = DependencyResolver.Resolve <IAccountConnectionService>();
            this._taskService         = DependencyResolver.Resolve <Cooper.Model.Tasks.ITaskService>();
            this._taskFolderService   = DependencyResolver.Resolve <ITaskFolderService>();
            this._addressBookService  = DependencyResolver.Resolve <IAddressBookService>();
            this._contactGroupService = DependencyResolver.Resolve <IContactGroupService>();
            this._contactService      = DependencyResolver.Resolve <IContactService>();
            this._teamService         = DependencyResolver.Resolve <ITeamService>();
            this._personalTaskService = DependencyResolver.Resolve <Cooper.Model.Tasks.IPersonalTaskService>();
            this._teamTaskService     = DependencyResolver.Resolve <Cooper.Model.Teams.ITaskService>();
        }
Example #2
0
        public void TestFixtureSetUp()
        {
            try
            {
                CodeSharp.Core.Configuration.ConfigWithEmbeddedXml(null
                    , "application_config"
                    , Assembly.GetExecutingAssembly()
                    , "Cooper.Model.Test.ConfigFiles")
                    .RenderProperties()
                    .Castle(o => this.Resolve(o.Container));

                //初始化同步锁
                DependencyResolver.Resolve<ILockHelper>().Init<Account>();
                DependencyResolver.Resolve<ILockHelper>().Init<GoogleConnection>();
                DependencyResolver.Resolve<ILockHelper>().Init<GitHubConnection>();
                DependencyResolver.Resolve<ILockHelper>().Init<Member>();
            }
            catch (Exception e)
            {
                if (!e.Message.Contains("不可重复初始化配置")){
                    Console.WriteLine(e.Message);
                    throw e;
                }
            }

            this._log = DependencyResolver.Resolve<ILoggerFactory>().Create(this.GetType());
            this._sessionManager = DependencyResolver.Resolve<Castle.Facilities.NHibernateIntegration.ISessionManager>();

            this._accountHelper = DependencyResolver.Resolve<IAccountHelper>();
            this._accountService = DependencyResolver.Resolve<IAccountService>();
            this._accountConnectionService = DependencyResolver.Resolve<IAccountConnectionService>();
            this._taskService = DependencyResolver.Resolve<Cooper.Model.Tasks.ITaskService>();
            this._taskFolderService = DependencyResolver.Resolve<ITaskFolderService>();
            this._addressBookService = DependencyResolver.Resolve<IAddressBookService>();
            this._contactGroupService = DependencyResolver.Resolve<IContactGroupService>();
            this._contactService = DependencyResolver.Resolve<IContactService>();
            this._teamService = DependencyResolver.Resolve<ITeamService>();
            this._personalTaskService = DependencyResolver.Resolve<Cooper.Model.Tasks.IPersonalTaskService>();
            this._teamTaskService = DependencyResolver.Resolve<Cooper.Model.Teams.ITaskService>();
        }