コード例 #1
0
        public void TraverseTreeArgumentExceptionTest()
        {
            // Arrange
            var parser = new HomeExercisesParser("Folder");

            // Asert and Act
            Assert.Throws <ArgumentException>(() => parser.TraverseTree());
        }
コード例 #2
0
        public void TraverseTreeSuccessfullImportTest()
        {
            // Arrange
            var parser   = new HomeExercisesParser(@"C:\Users\anton\Desktop\HETS.Project\Matala3\JavaExercises\Exc1\excercise1\495398");
            int expected = 1;

            // Act
            parser.TraverseTree();

            //Assert
            Assert.Equal(expected, parser.HomeExercises.Count);
        }
コード例 #3
0
        // called when Import Home Exercise clicked
        void ExecuteImportHomeExercise()
        {
            _regionManager.RequestNavigate("ContentRegion", "IOTestView");
            _regionManager.RequestNavigate("ContentRegion", "ResultsView");
            //get folder path from user
            FolderPath = _dialogService.ShowFolderBrowserDialog();
            if (FolderPath != null)
            {
                parser = new HomeExercisesParser(FolderPath);
                parser.TraverseTree();
            }

            if (parser != null && parser.HomeExercises.Count > 0)
            {
                FolderPath = $"\nSuccessful imported {parser.HomeExercises.Count} Home Exercises";
                _eventAggregator.GetEvent <UpdateHomeExercisesEvent>().Publish(parser.HomeExercises);
                CanTest = true;
            }
            else
            {
                _dialogService.ShowMessageBox("Failed to import home exercises");
            }
        }