public void ImportFile_SingleWSMode_Throws() { _model = new WritingSystemSetupModel(new WritingSystemDefinition()); Assert.Throws <InvalidOperationException>( () => _model.ImportFile("foo.xml") ); }
private void ImportMenuClick(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "LDML files (*.ldml;*.xml)|*.ldml;*.xml|All files (*.*)|*.*"; dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); dialog.RestoreDirectory = true; if (dialog.ShowDialog(this) == DialogResult.OK) { // There's no reason for the program to crash if the import fails. // See https://jira.sil.org/browse/WS-112 for details. try { _model.ImportFile(dialog.FileName); } catch (ApplicationException ex) { ErrorReport.NotifyUserOfProblem(ex, "There was a problem reading the LDML (language/orthography definition) file."); } } }
public void ImportFile_Null_Throws() { Assert.Throws <ArgumentNullException>( () => _model.ImportFile(null) ); }
public void ImportFile_SingleWSMode_Throws() { _model = new WritingSystemSetupModel(new WritingSystemDefinition()); Assert.Throws<InvalidOperationException>( () => _model.ImportFile("foo.xml") ); }