using System.ComponentModel; using System.IO; using Caliburn.Services; namespace Caliburn.Testability { public class StubOpenFileDialog : IOpenFileDialog { private bool _addExtension; private bool _checkFileExists; private bool _checkPathExists; private string _defaultExt; private bool _dereferenceLinks; private bool? _dialogResult = true; private string _fileName; private string[] _fileNames; private string _filter; private int _filterIndex; private string _initialDirectory; private bool _multiselect; private bool _readOnlyChecked; private bool _restoreDirectory; private string _safeFileName; private string[] _safeFileNames; private bool _showReadOnly; private object _tag; private string _title; private bool _validateNames; public bool? DialogResult { get { return _dialogResult; } set { _dialogResult = value; } } #region IOpenFileDialog Members public bool Multiselect { get { return _multiselect; } set { _multiselect = value; } } public bool ReadOnlyChecked { get { return _readOnlyChecked; } set { _readOnlyChecked = value; } } public bool ShowReadOnly { get { return _showReadOnly; } set { _showReadOnly = value; } } public Stream OpenFile() { return Stream.Null; } public Stream[] OpenFiles() { return new Stream[0]; } public bool CheckPathExists { get { return _checkPathExists; } set { _checkPathExists = value; } } public bool CheckFileExists { get { return _checkFileExists; } set { _checkFileExists = value; } } public bool AddExtension { get { return _addExtension; } set { _addExtension = value; } } public string DefaultExt { get { return _defaultExt; } set { _defaultExt = value; } } public bool DereferenceLinks { get { return _dereferenceLinks; } set { _dereferenceLinks = value; } } public string[] FileNames { get { return _fileNames; } } public string FileName { get { return _fileName; } set { _fileName = value; } } public bool ValidateNames { get { return _validateNames; } set { _validateNames = value; } } public string Title { get { return _title; } set { _title = value; } } public string[] SafeFileNames { get { return _safeFileNames; } } public string SafeFileName { get { return _safeFileName; } } public bool RestoreDirectory { get { return _restoreDirectory; } set { _restoreDirectory = value; } } public string InitialDirectory { get { return _initialDirectory; } set { _initialDirectory = value; } } public int FilterIndex { get { return _filterIndex; } set { _filterIndex = value; } } public string Filter { get { return _filter; } set { _filter = value; } } public event CancelEventHandler FileOk; public object Tag { get { return _tag; } set { _tag = value; } } public bool? ShowDialog() { return _dialogResult; } public void Reset() {} #endregion } }