예제 #1
0
 private void UpdateFiltersStates(object sender, EventArgs e)
 {
     if (InvokeRequired)
     {
         //recursive call to switch threads if InvokeRequired
         Invoke(new EventHandler(cbMultipleFilters_Changed));
         return;
     }
     else
     {
         Filter.Update(sender, new SMSFormEventArgs(cboSMSSenderSelector, dtFilterFromTime, dtFilterToTime, tbSearchTextInMessages));
     }
 }
        public void FilterBySenderTest()
        {
            //Arrenge
            //Create and fill SMS Repository
            SMSStorage sMSStorage = new SMSStorage(FiltersState, ExpectedFilteredMessages1);

            AddMessagesToSMSStorage(sMSStorage);
            //Create Filter Criteria
            UserSelectedSender.Items.Add("Bank");
            UserSelectedSender.SelectedIndex = 1;
            //Act
            FiltersState.Update(_sender, new SMSFormEventArgs(UserSelectedSender, FilterFrom, FilterTo, TextToSearch)
            {
            });
            //Assert
            Assert.AreEqual(1, sMSStorage.FilteredMessages.Count);
            Assert.AreEqual(ExpectedFilteredMessages1[0].Sender, sMSStorage.FilteredMessages[0].Sender);
            Assert.AreEqual(ExpectedFilteredMessages1[0].Text, sMSStorage.FilteredMessages[0].Text);
            Assert.AreEqual(ExpectedFilteredMessages1[0].TimeReceived, sMSStorage.FilteredMessages[0].TimeReceived);
        }