public ActionResult FileUpload(MaturityDataFile maturityDataFile) { try { if (ModelState.IsValid) { var policyDetails = policyManagement.GetPolicyDetails(maturityDataFile.File.InputStream); if (!policyDetails.Any()) { ModelState.AddModelError("Data Validation", "No policies found."); return(View("Index")); } var maturityDetails = policyManagement.GetMaturityDetails(policyDetails); var fileContent = policyManagement.GetPolicyMaturities(maturityDetails); ViewBag.Message = "Input File has been uploaded successfully and Output file has been downloaded successfully"; ModelState.Clear(); return(File(fileContent, MediaTypeNames.Text.Xml, "PolicyMaturity.xml")); } } catch (Exception ex) { ModelState.AddModelError("Error Message", ex.Message); } return(View("Index")); }
public MaturityTests() { var list = MaturityDataFile.ParseYaml().Load <Maturity>(); human = list.First(x => x.Name == "human"); dwarf = list.First(x => x.Name == "dwarf"); }
public void Test_Intialize() { uploadFile = new MaturityDataFile(); }
public void SetUp() { gateway = new RaceMaturityYamlGateway(MaturityDataFile.ParseYaml()); human = gateway.All().First(x => x.Name == "human"); dwarf = gateway.All().First(x => x.Name == "dwarf"); }