コード例 #1
0
ファイル: ServiceTest.cs プロジェクト: hajimen/flowerflower
        public void TestSimple()
        {
            TService s = new TService(true, SecureConstant.P12File, SecureConstant.P12FilePassword);

            Payload p = new Payload();
            p.Badge = 1;
            p.Message = "test";

            Notification n = new TNotification(int.MaxValue, p, "44F5AE40CC0FFC100A4984D2D949A337B3633B6B266F03674439B2F776A49FD3"); // valid token
            s.Enqueue(n);

            Thread.Sleep(5000);
            Expect(s.isAborted, Is.EqualTo(false));

            Notification n2 = new TNotification(int.MaxValue, p, "D4D9B50237423A48633F05F74FED2132BB49A1833565EE580E321E5A6A18DE95"); // invalid token
            p.Message = "test2";
            Notification n3 = new TNotification(int.MaxValue, p, "44F5AE40CC0FFC100A4984D2D949A337B3633B6B266F03674439B2F776A49FD3");
            s.Enqueue(n2);
            s.Enqueue(n3);

            Thread.Sleep(5000);
            Expect(s.isAborted, Is.EqualTo(true));

            s.Close();
        }
コード例 #2
0
        // 新增通知
        public void AddNoti(int toUserId, string notiHeader, string notiBody)
        {
            var           user = HttpContext.Session.GetObject <TUser>(CDictionary.Current_User);
            TNotification noti = new TNotification();

            noti.FromUserId  = user.CEmployeeId;
            noti.ToUserId    = toUserId;
            noti.NotiHeader  = notiHeader;
            noti.NotiBody    = notiBody;
            noti.IsRead      = false;
            noti.Url         = "123";
            noti.CreatedDate = DateTime.Now;

            myHR.Add(noti);
            myHR.SaveChanges();
        }