Example #1
0
        public void OrCondTest()
        {
            List <Message> messages  = InitMessages();
            var            filterObj = new MsgFilterObj()
            {
                Messages      = messages,
                User          = "******",
                MessageText   = "H",
                StartTime     = null,
                EndTime       = null,
                UseAndForCond = false
            };

            IEnumerable <Message> act_msgs = MsgFilter.ApplyFilter(filterObj);
            bool isSequenceEqual           = Enumerable.SequenceEqual(messages, act_msgs);

            Assert.IsTrue(isSequenceEqual);
        }
Example #2
0
        public void AndCondTest()
        {
            List <Message> messages  = InitMessages();
            var            filterObj = new MsgFilterObj()
            {
                Messages      = messages,
                User          = "******",
                MessageText   = "H",
                StartTime     = now,
                EndTime       = now,
                UseAndForCond = true
            };

            IEnumerable <Message> exp_msgs = new List <Message>
            {
                messages[0], messages[1]
            };
            IEnumerable <Message> act_msgs = MsgFilter.ApplyFilter(filterObj);
            bool isSequenceEqual           = Enumerable.SequenceEqual(exp_msgs, act_msgs);

            Assert.IsTrue(isSequenceEqual);
        }
Example #3
0
        private void RefreshMessagesView()
        {
            var filterObj = new MsgFilterObj()
            {
                Messages      = Mobile.MessageStorage.GetMessages().ToList(),
                User          = UsersComboBox.SelectedItem as string,
                MessageText   = MsgSearchTextBox.Text,
                StartTime     = null,
                EndTime       = null,
                UseAndForCond = UseAndCheckBox.Checked
            };

            if (MsgStartDateTime.Checked)
            {
                filterObj.StartTime = MsgStartDateTime.Value;
            }
            if (MsgEndDateTime.Checked)
            {
                filterObj.EndTime = MsgEndDateTime.Value;
            }

            ShowMessages(MsgFilter.ApplyFilter(filterObj));
        }