public static ContainerBuilder SaveExportedFilesTo(this ContainerBuilder builder, string fileName) { var fileChooser = Substitute.For <IFileSaveChooser>(); fileChooser.GetFileSaveLocation().Returns(Task.FromResult(ExportResult.Success(fileName))); builder.Register(_ => fileChooser).As <IFileSaveChooser>(); return(builder); }
private ExportResult GetValue() { using (var dialog = new SaveFileDialog { Filter = "Excel spreadsheet|*.xlsx;*.xls;|All files|*.*" }) { shower.ShowDialog(dialog); if (!String.IsNullOrWhiteSpace(dialog.FileName)) { return(ExportResult.Success(dialog.FileName)); } return(ExportResult.Incomplete()); } }