示例#1
0
        public void Init()
        {
            Root = Path.Combine(Directory.GetCurrentDirectory(), nameof(SnapshotReportGeneratorTests));
            AbstractSyntaxTreeGenerator = new MockAbstractSyntaxTreeGenerator {
                Throw = false
            };
            Reports   = new MockRepository <SnapshotReport, int>();
            Generator = new SnapshotReportGenerator(
                AbstractSyntaxTreeGenerator,
                new MockAbstractSyntaxTreeClassExtractor(), Reports,
                new MockSnapshotMethodGenerator(),
                new MockUnitTestGenerator()
                );
            Data = new SubmissionData(new StudentSubmissionDto()
            {
                ClassName      = "ClassName",
                StudentName    = "StudentName",
                SnapshotFolder = MockSnapshots.GetCalculatorSnapshots(),
            }, Root);

            Assignment = new Assignment()
            {
                Filename = MockSnapshots.GetCalculatorFile(),
                Solution = new AssignmentSolution()
                {
                    Name = MockSnapshots.GetCalculatorClassName(),
                },
            };
        }
示例#2
0
        public void Init()
        {
            Root = Path.Combine(MockSnapshots.GetShortRoot(), "Powershell");
            Data = new SubmissionData(new StudentSubmissionDto()
            {
                StudentName    = "StudentName",
                ClassName      = "ClassName",
                SnapshotFolder = MockSnapshots.GetCalculatorSnapshots(),
            }, Root);

            Assignment = new Assignment()
            {
                TestProject = new TestProject()
                {
                    Id              = 1,
                    Files           = MockSnapshots.GetCalculatorTestProjectFiles(),
                    TestFolder      = MockSnapshots.GetCalculatorTestProjectFolder(),
                    TestDllFile     = MockSnapshots.GetCalculatorTestProjectDll(),
                    TestProjectFile = MockSnapshots.GetCalculatorTestProjectFile(),
                    UnitTests       = MockSnapshots.GetCalculatorUnitTests(),
                },
                TestProjectId = 1,
            };
            Generator = new PowershellUnitTestGenerator(
                Microsoft.Extensions.Options.Options.Create(
                    new PowershellOptions()
            {
                CommandPath = MockSnapshots.PowershellScript(),
                PassedValue = MockSnapshots.PowershellPassedValue(),
                ResultsFile = "test_results.txt",
            }));
        }
        public void Init()
        {
            Submission = new StudentSubmissionDto()
            {
                StudentName    = StudentName,
                ClassName      = ClassName,
                SnapshotFolder = MockSnapshots.GetCalculatorSnapshots(),
            };

            Root = Path.Combine(Directory.GetCurrentDirectory(), nameof(SubmissionDataTests));
        }
 public void Init()
 {
     Root = Path.Combine(Directory.GetCurrentDirectory(), nameof(ClangAbstractSyntaxTreeGeneratorTests));
     Data = new SubmissionData(new StudentSubmissionDto()
     {
         SnapshotFolder = MockSnapshots.GetCalculatorSnapshots(),
         StudentName    = "Student",
         ClassName      = "Class",
     }, Root);
     Generator = new ClangAbstractSyntaxTreeGenerator(
         Microsoft.Extensions.Options.Options.Create(new ClangOptions()
     {
         Command    = MockSnapshots.ClangCommand,
         Arguments  = MockSnapshots.ClangArguments,
         OutputFile = MockSnapshots.ClangOutputFile,
     }), new MockClangAbstractSyntaxTreeExtractor());
 }
        public void Init()
        {
            Students = new MockRepository <Student, string>(
                new List <Student>()
            {
                new Student()
                {
                    Id   = StudentId,
                    Name = StudentName,
                    StudentCourseClasses = new List <StudentCourseClass>()
                    {
                        new StudentCourseClass()
                        {
                            Class = new CourseClass()
                            {
                                Id   = ClassId,
                                Name = ClassName,
                            }
                        }
                    }
                }
            });

            Surveys           = new MockRepository <Survey, string>();
            SnapshotGenerator = new MockSnapshotGenerator();
            Runner            = new EngineRunner(Microsoft.Extensions.Options.Options.Create(
                                                     new EngineRunnerOptions()
            {
                SurveyUrl = "Blank",
            }), Students, Surveys,
                                                 SnapshotGenerator, new MockAssignmentGenerator(), new MockMarkovModelGenerator());
            Root = Path.Combine(Directory.GetCurrentDirectory(), nameof(EngineRunnerTests));

            Submission = new StudentSubmissionDto()
            {
                SnapshotFolder = MockSnapshots.GetCalculatorSnapshots(),
            };
        }
示例#6
0
        public void Init()
        {
            Root = Path.Combine(Directory.GetCurrentDirectory(), nameof(SnapshotGeneratorTests));

            Submission = new StudentSubmissionDto()
            {
                SnapshotFolder = MockSnapshots.GetCalculatorSnapshots(),
                StudentName    = StudentName,
                ClassName      = "Class",
            };
            Assignment = new Assignment()
            {
                Id       = AssignmentId,
                Filename = MockSnapshots.GetCalculatorFile(),
                Solution = new AssignmentSolution()
                {
                    Files = MockSnapshots.GetCalculatorSolutionFiles(),
                    Name  = MockSnapshots.GetCalculatorClassName(),
                }
            };

            Student =
                new Student()
            {
                Id          = StudentId,
                Name        = StudentName,
                Submissions = new List <SnapshotSubmission>()
                {
                    new SnapshotSubmission()
                    {
                        Id = FirstCalculatorSubmissionId,
                        CreatedDateTime = MockSnapshots.GetFirstCalculatorSnapshotTime(),
                    }
                },
                Snapshots = new List <Snapshot>()
                {
                    new Snapshot()
                    {
                        Id = FirstCalculatorSubmissionId,
                        SnapshotSubmission = new SnapshotSubmission()
                        {
                            Id = FirstCalculatorSubmissionId,
                            CreatedDateTime = MockSnapshots.GetFirstCalculatorSnapshotTime(),
                            Files           = MockSnapshots.GetFirstCalculatorSnapshotFile(),
                        },
                        AssignmentId = AssignmentId
                    },
                    new Snapshot()
                    {
                        Id = LastSnapshotId,
                        SnapshotSubmission = new SnapshotSubmission()
                        {
                            Id = 2,
                            CreatedDateTime = MockSnapshots.GetSecondCalculatorSnapshotTime(),
                            Files           = MockSnapshots.GetSecondCalculatorSnapshotFile(),
                        },
                        AssignmentId = AssignmentId
                    }
                }
            };
            Students = new MockRepository <Student, string>();
            Students.Add(Student);
            Snapshots          = new MockRepository <Snapshot, int>();
            SnapshotSubmission = new MockRepository <SnapshotSubmission, int>(
                new List <SnapshotSubmission>()
            {
                new SnapshotSubmission()
                {
                    Id = FirstCalculatorSubmissionId,
                    CreatedDateTime = MockSnapshots.GetFirstCalculatorSnapshotTime()
                }
            });
            Generator = new SnapshotGenerator(new MockSnapshotDateConverter(), SnapshotSubmission,
                                              Snapshots, new MockSnapshotReportGenerate(), Students,
                                              new MockAbstractSyntaxClassTreeExtractor(),
                                              new MockAbstractSyntaxTreeGenerator());
            Data = new SubmissionData(Submission, Root)
            {
                Student = Student
            };
            GeneratorObj = new SnapshotGenerator.SnapshotGeneratorObj(Data, Assignment, Generator);
        }