コード例 #1
0
        public ActionResult DownloadTestFileRun(string testRun)
        {
            byte[] testFile  = null;
            var    formatter = new TestRatioFormatter();

            using (var context = new Entities())
            {
                var testRunDb = context.TestRuns.Find(Convert.ToInt32(testRun));

                testFile = formatter.GenerateTestData(testRunDb.TestSetId, testRunDb.TrainRatio);
            }

            var cd = new System.Net.Mime.ContentDisposition
            {
                FileName = "TestRun_#" + testRun + ".txt",
                Inline   = false
            };

            Response.AppendHeader("Content-Disposition", cd.ToString());

            return(File(testFile, "text/plain"));
        }
コード例 #2
0
 public void GenerateTestData_ValidInput_ValidOutput()
 {
     var formatter = new TestRatioFormatter();
     var result    = formatter.GenerateTestData(1, "10");
 }