Beispiel #1
0
 public Call(Contact cont, string phone, CallDirections direction, DateTime callTime)
 {
     Cont      = cont;
     Phone     = phone;
     Direction = direction;
     CallTime  = callTime;
 }
Beispiel #2
0
 public Call(Contact contact, string phoneNumber, DateTime callTime, CallDirections callDirection, TimeSpan callDuration)
 {
     Contact       = contact;
     PhoneNumber   = phoneNumber;
     CallTime      = callTime;
     CallDirection = callDirection;
     CallDuration  = callDuration;
 }
Beispiel #3
0
 public Call(Contact cont, string phone, DateTime callTime, CallDirections direction, double duration)
 {
     Cont            = cont;
     Phone           = phone;
     CallTime        = callTime;
     CallTimeHistory = callTime;
     Direction       = direction;
     Duration        = duration;
     Num             = 1;
 }
Beispiel #4
0
        public void SameContactDirectionDifferentPhoneTimeEqualityCheck()
        {
            // Arrange
            Contact        contact       = new Contact(1, "Contact 1", new List <string>(new[] { "+380950000001", "+380950000002" }));
            CallDirections callDirection = CallDirections.Outgoing;

            Call callX = new Call(contact, contact.PhoneNumbers.ElementAt(0), new DateTime(2020, 4, 19, 9, 20, 1), callDirection, new TimeSpan(0, 2, 3));
            Call callY = new Call(contact, contact.PhoneNumbers.ElementAt(1), new DateTime(2020, 4, 19, 10, 00, 05), callDirection, new TimeSpan(0, 16, 20));

            bool expectedEqualityCheckResult = true;

            // Act
            bool actualEqualityCheckResult = callY.Equals(callX);

            //Assert
            Assert.AreEqual(expectedEqualityCheckResult, actualEqualityCheckResult);
        }
Beispiel #5
0
        public void SameContactDirectionDifferentPhoneTimeComparison()
        {
            // Arrange
            Contact        contact       = new Contact(1, "Contact 1", new List <string>(new[] { "+380950000001", "+380950000002" }));
            CallDirections callDirection = CallDirections.Outgoing;

            Call callX = new Call(contact, contact.PhoneNumbers.ElementAt(0), new DateTime(2020, 4, 19, 9, 20, 1), callDirection, new TimeSpan(0, 2, 3));
            Call callY = new Call(contact, contact.PhoneNumbers.ElementAt(1), new DateTime(2020, 4, 19, 10, 00, 05), callDirection, new TimeSpan(0, 10, 21));

            int expectedComparisonResult = -1;

            // Act
            int actualComparisonResult = callY.CompareTo(callX);

            //Assert
            Assert.AreEqual(expectedComparisonResult, actualComparisonResult);
        }
Beispiel #6
0
        public List <Call> GetListHistory(Contact contact, string contactPhone, CallDirections direction, DateTime dt)
        {
            Call        tempCall = new Call(contact, contactPhone, direction, dt);
            List <Call> history  = new List <Call>();

            foreach (var item in saveHistory)
            {
                if (item.Equals(tempCall))
                {
                    history.Add(item);
                }
            }
            for (var i = callList.Count - 1; i >= 0; i--)
            {
                if (callList[i].Equals(tempCall))
                {
                    history.Add(callList[i]);
                    break;
                }
            }
            return(history);
        }