예제 #1
0
        public void TestRequestChat()
        {
            MyVisitSessionServiceProvider provider = new MyVisitSessionServiceProvider();

            VisitSessionService.Provider = provider;
            MyChatProvider pp = new MyChatProvider();

            ChatService.Provider = pp;
            VisitSession v = new VisitSession();

            v.SessionId = "aaaaa";
            VisitSessionService.NewSession(v);
            Chat ch = new Chat();

            ch.AccountId  = "2";
            ch.ChatId     = "mfdsa";
            ch.CreateTime = DateTime.Now;
            ch.Status     = LiveSupport.LiveSupportModel.ChatStatus.Requested;
            ch.VisitorId  = "bbb";
            //  VisitSessionService.RequestChat(ch);
            Assert.AreEqual(0, ChatService.chats.Count);
            //Chat ch1 = new Chat();
            //ch.AccountId = "2";
            //ch1.ChatId = "aaaaa";
            //ch.VisitorId = "bbb";
            //VisitSessionService.RequestChat(ch1);
            //Assert.AreEqual(1, ChatService.chats.Count);
        }
예제 #2
0
        public void TestNewSessionMaxNum()
        {
            MyVisitSessionServiceProvider provider = new MyVisitSessionServiceProvider();

            VisitSessionService.Provider = provider;
            for (int i = 0; i < 210; i++)
            {
                VisitSession s = new VisitSession();
                s.Status = VisitSessionStatus.Leave;
                VisitSessionService.NewSession(s);
            }

            Assert.AreEqual(200, VisitSessionService.Sessions.Count);
        }
예제 #3
0
        public void TestNewSession()
        {
            MyVisitSessionServiceProvider provider = new MyVisitSessionServiceProvider();
            VisitSession v = new VisitSession();

            VisitSessionService.Provider = provider;
            VisitSessionService.NewSession(v);
            Assert.AreEqual(1, provider.Sessions.Count);
            VisitSession vv = new VisitSession();

            vv.SessionId = v.SessionId;
            VisitSessionService.NewSession(vv);
            Assert.AreEqual(1, provider.Sessions.Count);
        }
예제 #4
0
        public void TestGetSessionById()
        {
            MyVisitSessionServiceProvider provider = new MyVisitSessionServiceProvider();

            VisitSessionService.Provider = provider;
            VisitSession v = new VisitSession();

            v.SessionId = "aaaaa";
            VisitSessionService.NewSession(v);
            Assert.AreEqual(v, VisitSessionService.GetSessionById(v.SessionId));
            Assert.AreEqual(1, VisitSessionService.Sessions.Count);
            for (int i = 0; i < 20; i++)
            {
                VisitSession vv = new VisitSession();
                vv.SessionId = "aaaaa";
                VisitSessionService.NewSession(vv);
            }

            Assert.AreEqual(1, VisitSessionService.Sessions.Count);
        }
예제 #5
0
        public void TestInvite()
        {
            LiveSupport.LiveSupportDAL.SqlProviders.DBHelper.ConnectionString = "Server=rd01;Database=LiveSupport;User ID=sa;Password=;Trusted_Connection=False;";
            OperatorService.Provider = new MyOperatorProvider();
            Account a = TestTool.CreateNewAccount();

            AccountService.AddAccount(a);
            Operator o = TestTool.CreateNewOperator(a.AccountId);

            OperatorService.NewOperator(o);
            Visitor v = TestTool.CreateNewVisitor(a.AccountId);

            VisitorService.NewVisitor(v);
            VisitSessionService.NewSession(v.CurrentSession);

            Operator op = OperatorService.Login(a.LoginName, a.LoginName, a.Password);

            ChatService.OperatorRequestChat(op.OperatorId, v.VisitorId);

            Assert.AreEqual(v.CurrentSession.SessionId, ChatService.GetOperatorInvitation(v.VisitorId));
        }