public void Test2() { IJT808SessionService jT808SessionServiceDefaultImpl = ServiceProvider.GetService <IJT808SessionService>(); var result1 = jT808SessionServiceDefaultImpl.GetTcpAll(); var result2 = jT808SessionServiceDefaultImpl.RemoveByTerminalPhoneNo("123456789001"); var result3 = jT808SessionServiceDefaultImpl.GetTcpAll(); }
public override Task <SessionRemoveReply> RemoveSessionByTerminalPhoneNo(SessionRemoveRequest request, ServerCallContext context) { var result = jT808SessionService.RemoveByTerminalPhoneNo(request.TerminalPhoneNo); return(Task.FromResult(new SessionRemoveReply { Success = result.Data })); }
/// <summary> /// 会话服务-通过设备终端号移除对应会话 /// </summary> /// <param name="request"></param> /// <returns></returns> public JT808HttpResponse RemoveSessionByTerminalPhoneNo(JT808HttpRequest request) { if (string.IsNullOrEmpty(request.Json)) { return(EmptyHttpResponse()); } var result = jT808SessionService.RemoveByTerminalPhoneNo(request.Json); return(CreateJT808HttpResponse(result)); }
public void RemoveByTerminalPhoneNoTest() { string tno = "123456789006"; IJT808SessionService jT808SessionServiceDefaultImpl = ServiceProvider.GetService <IJT808SessionService>(); SeedSession(tno); var result1 = jT808SessionServiceDefaultImpl.RemoveByTerminalPhoneNo(tno); Assert.Equal(JT808ResultCode.Ok, result1.Code); Assert.True(result1.Data); var result2 = jT808SessionServiceDefaultImpl.GetTcpAll(); Assert.Equal(JT808ResultCode.Ok, result2.Code); Assert.DoesNotContain(tno, result2.Data.Select(s => s.TerminalPhoneNo)); }