private void btnBrowConfig_Click(object sender, EventArgs e) { try { var openFileDialogConfigPath = new OpenFileDialog(); openFileDialogConfigPath.InitialDirectory = @"C:\"; openFileDialogConfigPath.Title = "Browse Config File"; openFileDialogConfigPath.CheckFileExists = true; openFileDialogConfigPath.CheckPathExists = true; openFileDialogConfigPath.DefaultExt = "config"; openFileDialogConfigPath.Filter = "Config file (*.config)|*.config"; openFileDialogConfigPath.FilterIndex = 2; openFileDialogConfigPath.RestoreDirectory = true; openFileDialogConfigPath.ReadOnlyChecked = true; openFileDialogConfigPath.ShowReadOnly = true; if (openFileDialogConfigPath.ShowDialog() == DialogResult.OK) { txtConfigTag.Text = openFileDialogConfigPath.FileName; lstConfig = configBusiness.Import(openFileDialogConfigPath.FileName); ShowOnListConfig(lstConfig); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Oops", MessageBoxButtons.OK, MessageBoxIcon.Error); txtConfigTag.Text = ""; } }
public void TestMethod1() { string strConfig = @"C:\Users\thedtv\Desktop\abc.config"; string flowPath = @"C:\Users\thedtv\Desktop\Maaa\Main.xaml"; string flowSeq = @"C:\Users\thedtv\Desktop\Maaa\MainSeq.xaml"; ConfigBusiness configBusiness = new ConfigBusiness(); string[] paths = { flowPath, flowSeq }; var lstCopnfig = configBusiness.Import(strConfig); Assert.AreEqual(lstCopnfig.Count, 6); Assert.AreNotEqual(lstCopnfig[0].Keyword, ""); }