Ejemplo n.º 1
0
 private static void ConcatErrorsOutputs(HomeExercise homeExercise)
 {
     foreach (var error in homeExercise.RunTestErrorsList)
     {
         homeExercise.RunTestErrorOutput += $"{error}\n";
     }
 }
Ejemplo n.º 2
0
        public async void StartRunTestOverAllSuccessTest(string homeExercisePath1)
        {
            //Arrange
            HomeExercise homeExercise1 = new HomeExercise()
            {
                HomeExercisePath = homeExercisePath1
            };

            List <HomeExercise> homeExercises = new List <HomeExercise>();

            homeExercises.Add(homeExercise1);


            string           inputFilePath    = @"C:\Users\anton\Desktop\HETS.Project\Matala3\JavaExercises\Exc1\HW1-inout\in1.txt";
            string           outputFilePath   = @"C:\Users\anton\Desktop\HETS.Project\Matala3\JavaExercises\Exc1\HW1-inout\out1.txt";
            string           input            = InputOutputParser.Parser(inputFilePath);
            string           output           = InputOutputParser.Parser(outputFilePath);
            InputOutputModel inputOutputModel = new InputOutputModel()
            {
                InputText = input, OutputText = output
            };
            List <InputOutputModel> inputOutputModels = new List <InputOutputModel>();

            inputOutputModels.Add(inputOutputModel);

            int secondsToWait = 5;
            //Act
            await RunTest.StartRunTest(homeExercises, inputOutputModels, secondsToWait);

            //Assert
            Assert.NotNull(homeExercise1.IsRunTestOk);
        }
Ejemplo n.º 3
0
        public void ToCsvSuccessTests()
        {
            //Arrange
            string        AppPath       = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
            DirectoryInfo myDir         = new DirectoryInfo(AppPath);
            string        dataDir       = myDir.Parent.Parent.FullName.ToString();
            HomeExercise  homeExercise  = new HomeExercise();
            var           homeExercises = new ObservableCollection <HomeExercise>();

            homeExercises.Add(homeExercise);
            //Act
            ExportToExcel.ToCsv(homeExercises);
            //Assert
            Assert.True(File.Exists(dataDir + "\\HomeExerciseReport.csv"));
        }
Ejemplo n.º 4
0
 private static void ErrorsChecker(HomeExercise homeExercise)
 {
     foreach (var error in homeExercise.RunTestErrorsList)
     {
         if (error != "")
         {
             homeExercise.IsRunTestOk = "Has Errors";
             ConcatErrorsOutputs(homeExercise);
         }
         else
         {
             homeExercise.IsRunTestOk = "Fine";
         }
     }
 }
Ejemplo n.º 5
0
 private static void CompatibleChecker(HomeExercise homeExercise)
 {
     foreach (var compatibleRunTest in homeExercise.CompatibleRunTestList)
     {
         if (compatibleRunTest == "not compatible")
         {
             homeExercise.IsCompatibleRunTest = "Not compatible";
             break;
         }
         else
         {
             homeExercise.IsCompatibleRunTest = "Compatible";
         }
     }
 }
Ejemplo n.º 6
0
        public async void StartCompilationTestOverallSuccessTest()
        {
            //Arrange
            HomeExercise homeExercise1 = new HomeExercise()
            {
                HomeExercisePath = @"C:\Users\anton\Desktop\HETS.Project\Matala3\JavaExercises\Exc1\excercise1\_495418_assignsubmission_file_\ArithmeticApp.java"
            };
            List <HomeExercise> homeExercises = new List <HomeExercise>();

            homeExercises.Add(homeExercise1);
            //Act
            await CompilationTest.StartCompilationTest(homeExercises);

            //Assert
            Assert.True(File.Exists(@"C:\Users\anton\Desktop\HETS.Project\Matala3\JavaExercises\Exc1\excercise1\_495401_assignsubmission_file_\ArithmeticApp.class"));
        }
Ejemplo n.º 7
0
        private static void CompareOutputs(InputOutputModel inputOutputModel, HomeExercise homeExercise)
        {
            //equal and ignore from symbols (white space etc...)
            if (String.Compare(inputOutputModel.OutputText, homeExercise.RunTestOutput,
                               CultureInfo.CurrentCulture, CompareOptions.IgnoreSymbols) == 0)
            {
                //do something when the output's compatible
                homeExercise.CompatibleRunTestList.Add("compatible");
            }
            else
            {
                //do something when the output's not compatible
                homeExercise.CompatibleRunTestList.Add("not compatible");
            }

            homeExercise.RunTestOutputs += $"{homeExercise.RunTestOutput}\n";
        }
Ejemplo n.º 8
0
        private void CreateHomeExercise(string fileName)
        {
            bool isMain = false;

            if (fileName.EndsWith(".java"))
            {
                isMain = IsMainFile(fileName);
            }

            if (isMain || fileName.EndsWith(".jar"))
            {
                string fileID       = new DirectoryInfo(Path.GetDirectoryName(fileName)).Name;
                string folderPath   = Path.GetDirectoryName(fileName) + "\\";
                string name         = Path.GetFileName(fileName);
                var    homeExercise = new HomeExercise()
                {
                    HomeExercisePath = folderPath, HomeExerciseFolderName = fileID, HomeExerciseName = name
                };
                HomeExercises.Add(homeExercise);
            }
        }