public void TestValidateReimbursementImportFile() { ReimbursementImportFile file = new ReimbursementImportFile { Name = "Import File", Extension = ".txt" }; try { _exportServices.ValidateFile(file); Assert.Fail("Required fields are missing"); } catch (OpenCbsCustomExportException e) { Assert.AreEqual(OpenCbsCustomExportExceptionEnum.SomeRequiredFieldsAreMissing, e.Code); } file.SelectedFields.Add(file.DefaultList.OfType <Field>().First(item => item.IsRequired).Clone() as IField); try { _exportServices.ValidateFile(file); Assert.Fail("Required fields are missing"); } catch (OpenCbsCustomExportException e) { Assert.AreEqual(OpenCbsCustomExportExceptionEnum.SomeRequiredFieldsAreMissing, e.Code); } file.SelectedFields.Clear(); foreach (var field in file.DefaultList.OfType <Field>().Where(item => item.IsRequired)) { file.SelectedFields.Add(field.Clone() as IField); } Assert.AreEqual(true, _exportServices.ValidateFile(file)); }
public void TestValidateReimbursementImportFile() { ReimbursementImportFile file = new ReimbursementImportFile { Name = "Import File", Extension = ".txt" }; try { _exportServices.ValidateFile(file); Assert.Fail("Required fields are missing"); } catch (OpenCbsCustomExportException e) { Assert.AreEqual(OpenCbsCustomExportExceptionEnum.SomeRequiredFieldsAreMissing, e.Code); } file.SelectedFields.Add(file.DefaultList.OfType<Field>().First(item => item.IsRequired).Clone() as IField); try { _exportServices.ValidateFile(file); Assert.Fail("Required fields are missing"); } catch (OpenCbsCustomExportException e) { Assert.AreEqual(OpenCbsCustomExportExceptionEnum.SomeRequiredFieldsAreMissing, e.Code); } file.SelectedFields.Clear(); foreach (var field in file.DefaultList.OfType<Field>().Where(item => item.IsRequired)) { file.SelectedFields.Add(field.Clone() as IField); } Assert.AreEqual(true, _exportServices.ValidateFile(file)); }
public CustomizableImportForm(IFile pFile) { InitializeComponent(); _reimbursementFile = (ReimbursementImportFile)pFile; openDataFileDialog.Filter = "Import|*" + pFile.Extension; }