コード例 #1
0
        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 BuildUpContext(new Unit(null, exBlock.SlideFolderPath), CourseSettings.DefaultSettings, null, "Test", string.Empty);

            exBlock.BuildUp(ctx, ImmutableHashSet <string> .Empty).ToList();
        }
コード例 #2
0
        public void SetUp()
        {
            exBlock = new ProjectExerciseBlock
            {
                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 ctx = new BuildUpContext(new Unit(null, exBlock.SlideFolderPath), CourseSettings.DefaultSettings, null, "Test", string.Empty);

            exBlock.BuildUp(ctx, ImmutableHashSet <string> .Empty).ToList();
        }
コード例 #3
0
        public void OneTimeSetUp()
        {
            TestsHelper.RecreateDirectory(tempSlideFolderPath);
            FileSystem.CopyDirectory(TestsHelper.ProjSlideFolderPath, tempSlideFolderPath);

            TestsHelper.RecreateDirectory(checkerExerciseFolderPath);
            TestsHelper.RecreateDirectory(studentExerciseFolderPath);

            Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);

            ex = new ProjectExerciseBlock
            {
                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 BuildUpContext(unit, CourseSettings.DefaultSettings, null, "Test", string.Empty);

            exBlocks = ex.BuildUp(ctx, ImmutableHashSet <string> .Empty).ToList();

            var builder = new ExerciseStudentZipBuilder();

            builder.BuildStudentZip(new ExerciseSlide(exBlocks, new SlideInfo(unit, null, 1), "", Guid.NewGuid(), meta: null), studentExerciseZipFilePath);

            Utils.UnpackZip(studentExerciseZipFilePath.Content(), 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());
        }