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); }
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); }
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); }
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); }
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)); }