Example #1
0
 public ChatbotController(BaiduSession session, ChatService chatService, RobotService robotService, CrmService crmService, ChatLogCache sessionCache)
 {
     _baiduSession = session;
     _chatService  = chatService;
     _robotService = robotService;
     _sessionCache = sessionCache;
     _crmService   = crmService;
 }
Example #2
0
        public static void RegisterComponents(BaiduSession baiduSession, bool isInternal)
        {
            var container = new UnityContainer();

            var chatSessions = new ChatLogCache();
            var crmSession   = CrmSession.CreateDefault(isInternal);

            container.RegisterInstance(crmSession);
            container.RegisterInstance(baiduSession, InstanceLifetime.Singleton);
            container.RegisterInstance(chatSessions, InstanceLifetime.Singleton);
            container.RegisterType <ChatService>();
            container.RegisterType <RobotService>();
            container.RegisterType <TokenService>();
            container.RegisterType <ChatLogService>();
            container.RegisterType <LeadService>();
            container.RegisterType <CrmService>();

            GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container);
        }
Example #3
0
 public void TearDown()
 {
     _cache = null;
 }
Example #4
0
 public void Setup()
 {
     _cache = new ChatLogCache();
 }