Exemplo n.º 1
0
        public void _01_ShouldGetToken()
        {
            var service    = new TokenService();
            var authResult = service.GetAccessToken(CrmSession.CreateDefault());

            Assert.IsFalse(string.IsNullOrEmpty(authResult.AccessToken));
        }
Exemplo n.º 2
0
        public void _01_CreateChatLogs()
        {
            var session    = CrmSession.CreateDefault();
            var service    = new TokenService();
            var authResult = service.GetAccessToken(session);

            Assert.IsFalse(string.IsNullOrEmpty(authResult.AccessToken));

            var chatLog = new ChatLogModel
            {
                SessionId = "session id xxxx",
                Log       = @"再多教它一些东西
                通过对话模板让技能模型学习用户意图的多种表达方式
                也可尽量多地告诉它用户的真实问句(对话样本),同时标出用户的意图和实现意图的关键信息
                对话模型就像个儿童,您教得越多,它越能领会您的意思,而且还能举一反三呢~
                这部分在【效果优化--训练数据】里完成",
                Tags      = "100000000,100000001,100000002,100000003",
                //LeadIdOdataBind = createdLeadGuid
            };

            var chatLogService = new ChatLogService();

            chatLogService.CreateChatLog(chatLog, session);
            Assert.IsFalse(string.IsNullOrEmpty(chatLog.CreatedChatLogGuid));
        }
Exemplo n.º 3
0
        public void _01_ShouldGetLeads()
        {
            var session    = CrmSession.CreateDefault();
            var service    = new TokenService();
            var authResult = service.GetAccessToken(session);

            Assert.IsFalse(string.IsNullOrEmpty(authResult.AccessToken));

            var leadService = new LeadService();
            var leads       = leadService.GetLeads(session);

            Assert.IsTrue(leads.Count() > 0);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        public void _02_CreateLeads()
        {
            var session    = CrmSession.CreateDefault();
            var service    = new TokenService();
            var authResult = service.GetAccessToken(session);

            Assert.IsFalse(string.IsNullOrEmpty(authResult.AccessToken));

            var lead = new LeadModel
            {
                Firstname     = "Morten",
                Lastname      = "Stanley",
                Emailaddress1 = "*****@*****.**",
                Mobilephone   = "13917163120",
                Telephone1    = "8485000"
            };

            var leadService = new LeadService();

            leadService.CreateLead(lead, session);
            Assert.IsFalse(string.IsNullOrEmpty(lead.CreatedLeadGuid));
        }