Example #1
0
        private void btnProcess_Click(object sender, RoutedEventArgs e)
        {
            if (!GetModelInstance().AllInputsAreFilled(txtBxXmlPathsFileName.Text, txtBxXmlFileName.Text, txtBxOutputFolder.Text))
            {
                MessageBox.Show(GetModelInstance().ErrorMessage,
                                "Uncomplete input provided", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            if (!GetModelInstance().AllInputsAreValid(txtBxXmlPathsFileName.Text, txtBxXmlFileName.Text, txtBxOutputFolder.Text))
            {
                MessageBox.Show(GetModelInstance().ErrorMessage,
                                "Invalid input(s) provided", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            var missingsInFile = processingService.GetListOfMissingsInFile(txtBxXmlPathsFileName.Text, txtBxXmlFileName.Text);

            try
            {
                btnProcess.IsEnabled = false;
                btnProcess.Content   = "Processing...";
                var outputFileCreated =
                    GetXmlFileServiceInstance()
                    .CreateOutputMissingInSourceFile(missingsInFile, txtBxOutputFolder.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show($"An error occured while trying to generate the result file.\n{ex.Message}",
                                "Output creation failed !", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            btnProcess.IsEnabled = true;
            btnProcess.Content   = "Process";
        }
Example #2
0
        public void ShouldGetCorrectListOfMissingsInFile()
        {
            var expectedList   = ArrangeListOfMissings();
            var xmlPathsFile   = @"Data\XmlPathsFile-sample01.txt";
            var missingsInFile = findMissingsService.GetListOfMissingsInFile(xmlPathsFile, @"Data\sample01.xml");

            Assert.IsTrue(expectedList.All(missingsInFile.Contains));
        }