public void DownloadFile_Found() { // ---- Arrange ---- // set up source file String srcPath = Path.Combine(Config.GetConfig().PathCustomerFolders, TestNote.cid.ToString()); String srcPathFile = Path.Combine(srcPath, TestNote.attachment); if (!Directory.Exists(srcPath)) { Directory.CreateDirectory(srcPath); } if (!File.Exists(srcPathFile)) { File.Create(srcPathFile).Close(); } // set up controller FrmNoteController controller = new FrmNoteController(); // ---- Act ---- FilePathResult result = controller.DownloadFile(TestNote.cid.ToString(), TestNote.attachment) as FilePathResult; // Assert Assert.IsNotNull(result); // clean up if (File.Exists(srcPathFile)) { File.Delete(srcPathFile); } if (Directory.Exists(srcPath)) { Directory.Delete(srcPath); } }
public void DownloadFile_NotFound() { // Arrange FrmNoteController controller = new FrmNoteController(); // Act HttpNotFoundResult result = controller.DownloadFile("0", "test.txt") as HttpNotFoundResult; // Assert Assert.IsNotNull(result); }