public void ServiceDecompositionDesignDataImportProcessor_NullServiceDecompositionTemplateFileName_ThrowsException() { #region Arrange #endregion _serviceDecompositionDesignDataImportProcessor.Execute(null, null, 1); #region Act #endregion #region Assert #endregion }
public ActionResult ImportServiceDecompositionSpreadsheet(ImportServiceDecompositionSpreadsheetViewModel model) { if (ModelState.IsValid) { var folder = SettingsHelper.ImportSpreadsheetFileLocation; // If the folder doesn't exist then create if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } var originalFullFileName = model.SpreadsheetFile.FileName; var newFileName = Guid.NewGuid() + Path.GetExtension(originalFullFileName); var newfullFileName = Path.Combine(folder, newFileName); try { model.SpreadsheetFile.SaveAs(newfullFileName); _serviceDecompositionDesignDataImportProcessor.Execute(newfullFileName, originalFullFileName, model.ServiceDeskId); return(Redirect(model.ReturnUrl)); } catch (Exception ex) { Guid errorGuid; ModelState.AddModelError(key: ModelStateErrorKey, errorMessage: Guid.TryParse(ex.Message, out errorGuid) ? string.Format(WebResources.ErrorMessage, errorGuid) : ex.Message); } finally { // Tidy up the file if it has not been deleted if (System.IO.File.Exists(newfullFileName)) { System.IO.File.Delete(newfullFileName); } } } return(View(model)); }