public void OneTimeSetUp() { TestsHelper.RecreateDirectory(tempSlideFolderPath); FileSystem.CopyDirectory(TestsHelper.ProjSlideFolderPath, tempSlideFolderPath); string studentZipFilepath = Path.Combine(tempSlideFolderPath, "ProjDir.exercise.zip"); if (File.Exists(studentZipFilepath)) { File.Delete(studentZipFilepath); } var ctx = new SlideBuildingContext("Test", new Unit(null, exerciseBlock.SlideFolderPath), CourseSettings.DefaultSettings, exerciseBlock.SlideFolderPath, null); // ReSharper disable once ReturnValueOfPureMethodIsNotUsed exerciseBlock.BuildUp(ctx, ImmutableHashSet <string> .Empty).ToList(); }
public void SetUp() { exerciseBlock = new CsProjectExerciseBlock { StartupObject = "test.Program", UserCodeFilePath = TestsHelper.UserCodeFileName, SlideFolderPath = tempSlideFolder, CsProjFilePath = TestsHelper.CsProjFilePath, }; FileSystem.CopyDirectory(TestsHelper.ProjSlideFolderPath, tempSlideFolderPath, true); string studentZipFilepath = Path.Combine(tempSlideFolderPath, "ProjDir.exercise.zip"); if (File.Exists(studentZipFilepath)) { File.Delete(studentZipFilepath); } var context = new SlideBuildingContext("Test", new Unit(null, exerciseBlock.SlideFolderPath), CourseSettings.DefaultSettings, null); // ReSharper disable once ReturnValueOfPureMethodIsNotUsed exerciseBlock.BuildUp(context, ImmutableHashSet <string> .Empty).ToList(); }
public void OneTimeSetUp() { TestsHelper.RecreateDirectory(tempSlideFolderPath); FileSystem.CopyDirectory(TestsHelper.ProjSlideFolderPath, tempSlideFolderPath); TestsHelper.RecreateDirectory(checkerExerciseFolderPath); TestsHelper.RecreateDirectory(studentExerciseFolderPath); Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); ex = new CsProjectExerciseBlock { StartupObject = "test.Program", UserCodeFilePath = TestsHelper.UserCodeFileName, SlideFolderPath = tempSlideFolder, CsProjFilePath = TestsHelper.CsProjFilePath, PathsToExcludeForStudent = new[] { "inner-dir-1\\inner-dir-2\\ExcludeMeForStudent.cs" } }; var unit = new Unit(null, ex.SlideFolderPath); var ctx = new SlideBuildingContext("Test", unit, CourseSettings.DefaultSettings, unit.Directory, null); exBlocks = ex.BuildUp(ctx, ImmutableHashSet <string> .Empty).ToList(); var builder = new ExerciseStudentZipBuilder(); builder.BuildStudentZip(new ExerciseSlide(exBlocks.ToArray()), studentExerciseZipFilePath); Utils.UnpackZip(studentExerciseZipFilePath.ReadAllContent(), studentExerciseFolderPath); var zipBytes = ex.GetZipBytesForChecker("i_am_user_code"); Utils.UnpackZip(zipBytes, checkerExerciseFolderPath); studentZipCsproj = new Project(studentCsProjFilePath, null, null, new ProjectCollection()); checkerZipCsproj = new Project(checkerCsprojFilePath, null, null, new ProjectCollection()); }