Exemple #1
0
        public void CallObjTestSorting()
        {
            var      list         = new List <Call>(1000);
            DateTime from         = new DateTime(1981, 06, 06);
            DateTime to           = DateTime.Now;
            TimeSpan timeSpan     = to - from;
            Random   rnd          = new Random();
            int      maxNumOfDays = timeSpan.Days;

            for (int i = 0; i < 1000; ++i)
            {
                int      telNum   = rnd.Next(111111, 999999);
                DateTime callTime = from.AddDays(rnd.Next(3, maxNumOfDays));
                string   name     = telNum.ToString();
                CallDir  dir      = (rnd.Next(0, 1000) % 2 == 0) ? CallDir.InCall : CallDir.OutCall;
                var      call     = new Call(name, callTime, dir);
                call.CallContact.PhoneNumbers.Add(telNum);
                list.Add(new Call(name, callTime, dir));
            }
            list.Sort();

            bool checkFlag = true;

            for (var i = 1; i < 1000; ++i)
            {
                int diff = (list[i].CallTime - list[i - 1].CallTime).Minutes;
                checkFlag &= diff <= 0;
            }

            Assert.AreEqual(checkFlag, true);
        }
Exemple #2
0
 public CallInfo()
 {
     this.CallIndex = -1;
     this.Dir = CallDir.unknown;
     this.Status = CallState.unknown;
     this.CallMode = CallMode.unknownn;
     this.IsMultipartyConferenceCall = false;
     this.Number = this.EntryInPhonebook = "-1";
     this.NumberType = CallNumberType.unknown;
 }
Exemple #3
0
        /// <summary>
        /// used to simulate generating sms messages for subscribed mobile phone (host phone).
        /// </summary>
        private void generateCalls()
        {
            if (vGenerateCallEvent != null)
            {
                string[] userNames    = new string[] { "AAA", "BBB", "BBB", "CCC", "CCC", "CCC", "CCC" };
                int[]    phoneNumbers = new int[] { 11111111, 22222222, 22222222, 33333333, 33333333, 33333333, 33333333 };
                Random   rnd          = new System.Random();

                DateTime callTime = DateTime.Now;
                int      ind      = rnd.Next(0, 3333333) % 7;
                string   name     = userNames[ind];
                int      telPh    = phoneNumbers[ind];
                int      temp     = ind % 3;
                CallDir  dir      = (temp == 0) ? CallDir.OutCall : CallDir.InCall;
                var      call     = new Call(name, callTime, dir);
                call.CallContact.PhoneNumbers.Add(telPh);
                vGenerateCallEvent(call);
            }
        }
Exemple #4
0
 public Call(string userName, DateTime callTime, CallDir callDirection)
 {
     CallContact   = new Contact(userName);
     CallTime      = callTime;
     CallDirection = callDirection;
 }