public void GetFileFialogTests(FileDialogsType dialogType, Type expectedRes) { //Act var result = FileDialogWrapper.GetFileFialog(dialogType); //Assert Assert.AreEqual(expectedRes, result.GetType()); }
/// <summary> /// Gets Open/Save file dialog, depends of type /// </summary> /// <param name="typeDialog">File dialog type<see cref="FileDialogsType"/></param> /// <returns>Dile Dialog<see cref="FileDialog"/></returns> public static FileDialog GetFileFialog(FileDialogsType typeDialog) { switch (typeDialog) { case FileDialogsType.Open: return(new OpenFileDialog { Filter = Formats, Multiselect = false }); case FileDialogsType.Save: return(new SaveFileDialog { Filter = Formats }); default: throw new NotSupportedException(); } }