Ejemplo n.º 1
0
        public void DataIOTest()
        {
            DataIOService dataIOService = new DataIOService(PATH);

            BindingList <ViewSettings> bindingListSave = new BindingList <ViewSettings>()
            {
                new ViewSettings()
                {
                    EnableSSL         = true,
                    Host              = "host",
                    Port              = 1,
                    UserEmail         = "email",
                    Name              = "name",
                    UserPassword      = "******",
                    TimeStartSettings = "* * * * * *",
                    MessageBody       = "body",
                    MessageSubject    = "subject",
                    RecieverEmail     = "email",
                    SenderEmail       = "email",
                    SenderName        = "name",
                    SiteUrl           = "https://www.eurosport.ru/football/bundesliga/standing.shtml",
                    TableClassID      = "standing-table",
                    ColumnToCompare   = "\u0412",
                    CompareValue      = "10",
                    NotNullColumn     = "\u0418"
                }
            };

            dataIOService.SaveData(bindingListSave);

            BindingList <ViewSettings> bindingListLoad = dataIOService.LoadData();

            Comparer comparer = new Comparer(CultureInfo.CurrentCulture);

            var viewSettingsLoad = bindingListLoad.FirstOrDefault();
            var viewSettingsSave = bindingListSave.FirstOrDefault();

            Assert.AreEqual(comparer.Compare(viewSettingsLoad, viewSettingsSave), 0);
        }
Ejemplo n.º 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            stopButton.IsEnabled = false;

            _dataIOService = new DataIOService(PATH);

            try
            {
                _dataSettingsList = _dataIOService.LoadData();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Close();
            }


            gridEmailSender.ItemsSource    = _dataSettingsList;
            itemEmailSender.DataContext    = _dataSettingsList;
            _dataSettingsList.ListChanged += DataSettingsList_ListChanged;

            FormMessageService formMessageService = new FormMessageService();
        }