Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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;
 }
Esempio n. 4
0
 public CustomizableImportForm(IFile pFile)
 {
     InitializeComponent();
     _reimbursementFile = (ReimbursementImportFile)pFile;
     openDataFileDialog.Filter = "Import|*" + pFile.Extension;
 }