Пример #1
0
        public void Init()
        {
            Root    = Path.Combine(Directory.GetCurrentDirectory(), nameof(AssignmentGeneratorTests));
            Handler = new DirectoryHandler(Root);
            PreAssignmentRepository = new MockRepository <PreAssignment, int>();

            Assignment = new PreAssignment()
            {
                PreAssignmentReport = new PreAssignmentPendingReport(),
                Filename            = MockSnapshots.GetCalculatorFile(),
                Solution            = new AssignmentSolution()
                {
                    Id    = 1,
                    Name  = MockSnapshots.GetCalculatorClassName(),
                    Files = MockSnapshots.GetCalculatorSolutionFiles(),
                    MethodDeclarations = MockSnapshots.GetCalculatorMethodDeclaration().ToList(),
                },
                AssignmentSolutionId = 1,
                TestProject          = new TestProject()
                {
                    Files           = MockSnapshots.GetCalculatorTestProjectFiles(),
                    TestFolder      = MockSnapshots.GetCalculatorTestProjectFolder(),
                    TestDllFile     = MockSnapshots.GetCalculatorTestProjectDll(),
                    TestProjectFile = MockSnapshots.GetCalculatorTestProjectFile()
                }
            };

            PreAssignmentRepository.Add(Assignment);
            AbstractSyntaxTreeGenerator       = new MockAbstractSyntaxTreeGenerator();
            AbstractSyntaxTreeClassExtractor  = new MockAbstractSyntaxTreeClassExtractor();
            AbstractSyntaxTreeMethodExtractor = new MockAbstractSyntaxTreeMethodExtractor();
            UnitTestGenerator = new MockUnitTestGenerator();

            Generator = new AssignmentGenerator(PreAssignmentRepository,
                                                AbstractSyntaxTreeGenerator,
                                                AbstractSyntaxTreeClassExtractor,
                                                AbstractSyntaxTreeMethodExtractor,
                                                UnitTestGenerator
                                                );
        }
Пример #2
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);
        }