Example #1
0
 public void Init()
 {
     CurrentDirectory = Path.Combine(Directory.GetCurrentDirectory(), "TracerTestTemp");
     Directory.CreateDirectory(CurrentDirectory);
     Factory = new EngineFactory(CurrentDirectory);
     Tracer  = new Tracer(Factory);
 }
Example #2
0
 public ManagerWrapper(TerminalWrapper terminal, IEngineFactory engineFactory)
 {
     EngineFactory = engineFactory;
     add(ManagerType.npm, new NpmManager(terminal));
     add(ManagerType.pip, new PipManager(terminal));
     add(ManagerType.system, new SystemManager(terminal));
 }
 public PlayerCreator(IPlayerFactory playerFactory, IEngineFactory engineFactory, IArmourFactory armourFactory, IWeaponFactory weaponFactory, ISpaceshipFactory spaceshipFactory, IBulletFactory bulletFactory)
 {
     this.playerFactory    = playerFactory;
     this.engineFactory    = engineFactory;
     this.armourFactory    = armourFactory;
     this.weaponFactory    = weaponFactory;
     this.spaceshipFactory = spaceshipFactory;
     this.bulletFactory    = bulletFactory;
 }
Example #4
0
 public DefinitionExecutor(
     ITemplateLoaderFactory templateLoaderFactory,
     IEngineFactory engineFactory,
     IResultProcessorFactory resultProcessorFactory
     )
 {
     _templateLoaderFactory  = templateLoaderFactory;
     _engineFactory          = engineFactory;
     _resultProcessorFactory = resultProcessorFactory;
 }
Example #5
0
 public MatchController(
     DatabaseContext context,
     ILogger <MatchController> logger,
     IMapper mapper,
     IDateTimeProvider dateTimeProvider,
     IEngineFactory engineFactory)
     : base(context, logger, mapper)
 {
     this.dateTimeProvider = dateTimeProvider;
     this.engineFactory    = engineFactory;
 }
Example #6
0
        public TempGameEngineService(ILogger logger, IEngineFactory engineFactory, IInputService inputService)
        {
            _logger        = logger;
            _engineFactory = engineFactory;
            _inputService  = inputService;

            _inputService.MouseDown += OnMouseDown;

            _logger.Info("Creating a game engine");
            Engine = engineFactory.Create(TestData, TestTemplates);
        }
Example #7
0
 public EngineService(
     IEngineFactory engineFactory,
     IFieldService fieldService,
     IShapeService shapeService,
     IInputService inputService
     )
 {
     this.engineFactory = engineFactory;
     this.fieldService  = fieldService;
     this.shapeService  = shapeService;
     this.inputService  = inputService;
 }
Example #8
0
 public CoverageStats(IEngineFactory factory)
 {
     _factory = factory;
 }
Example #9
0
 public CarFactory(IEngineFactory engineFactory)
 {
     _engineFactory = engineFactory;
 }
Example #10
0
 public CarFactory(IWheelFactory wheelFactory, IEngineFactory engineFactory, ILanternFactory lanternFactory)
 {
     this.WheelFactory   = wheelFactory;
     this.EngineFactory  = engineFactory;
     this.LanternFactory = lanternFactory;
 }
Example #11
0
		public CarFactory(IEngineFactory engineFactory)
		{
			_engineFactory = engineFactory;
		}
 public TestCaseAnalysis(IEngineFactory engineFactory)
 {
     EngineFactory = engineFactory;
 }
 public static Job With(this Job job, IEngineFactory engineFactory) => job.With(job.Infrastructure.EngineFactory.Mutate(engineFactory));
Example #14
0
 public Tracer(IEngineFactory factory)
 {
     Factory = factory;
 }
Example #15
0
 public CSharpEngine(IEngineFactory factory)
 {
     Factory = factory;
 }
 public BoatSimulatorController()
     : this(new BoatSimulatorDatabase(), null)
 {
     this.engineFactory = new EngineFactory();
 }
 public BoatSimulatorController(IBoatSimulatorDatabase database, IRace currentRace)
 {
     this.Database      = database;
     this.CurrentRace   = currentRace;
     this.engineFactory = new EngineFactory();
 }
 public static Job With(this Job job, IEngineFactory engineFactory) => job.WithEngineFactory(engineFactory);
 public LearningPreprocessor(IEngineFactory factory)
 {
     Factory = factory;
 }
Example #20
0
 public TemplateExecutor(IEngineFactory engineFactory)
 {
     _engineFactory = engineFactory;
 }
Example #21
0
 public EngineTestsBase()
 {
     Kernel.Bind<ILogger>().ToMock();
     Factory = Kernel.Get<IEngineFactory>();
 }
 public EngineTestsBase()
 {
     Kernel.Bind <ILogger>().ToMock();
     Factory = Kernel.Get <IEngineFactory>();
 }
 public static Job With(this Job job, IEngineFactory engineFactory) => job.WithCore(j => j.Infrastructure.EngineFactory = engineFactory);
 public static Job With(this Job job, IEngineFactory engineFactory) => job.WithCore(j => j.Infrastructure.EngineFactory = engineFactory);
Example #25
0
 public PythonEngine(IEngineFactory factory)
 {
     Factory = factory;
 }
Example #26
0
        public void FullEngineLearningModeShouldPassWithOneTest()
        {
            // Arrange
            FeedbackDto actual = new FeedbackDto();

            Factory = new MockEngineFactory(CurrentDirectory,
                                            new MockFeedback(f => actual = f));
            Engine = new Engine.PythonEngine(Factory);
            var submission = new SubmissionDto()
            {
                ApplicationMode  = "Learning Mode",
                SubmitterId      = "Random",
                SubmissionId     = 1,
                TestCaseSolution = ConvertToZipByteArray(
                    "import sys\r\n" +
                    "sys.path.append('../Solution/')\r\n" +
                    "from solution import func\r\n" +
                    "def test():\r\n" +
                    "   assert func() == 3",
                    "test_student.py"),
                ReferenceSolution = ConvertToZipByteArray(
                    "def func():\r\n" +
                    "   return 3",
                    "solution.py"),
                SolutionFolderName    = "Solution",
                ReferenceTestSolution = ConvertToZipByteArray(
                    "import sys\r\n" +
                    "sys.path.append('../Solution/')\r\n" +
                    "from solution import func\r\n" +
                    "def test_teacher(record_property):\r\n" +
                    "   record_property(\"EquivalanceClass\", \"FUNCTION CALL\")\r\n" +
                    "   record_property(\"Concepts\", \"func,equals\")\r\n" +
                    "   assert func() == 3\r\n"
                    , "test_teacher.py"),
            };

            // Act
            var feedbackDto = Engine.Run(submission);

            // Assert
            var expected = new FeedbackDto()
            {
                InstructorTests = new List <InstructorTestDto>()
                {
                    new InstructorTestDto()
                    {
                        Name             = "test_teacher.py::test_teacher",
                        Concepts         = new string[] { "func", "equals" },
                        EquivalenceClass = "FUNCTION CALL",
                        TestStatus       = TestStatusEnum.Covered,
                        StudentTests     = new List <StudentTestDto>()
                        {
                            new StudentTestDto()
                            {
                                Name       = "test_student.py::test",
                                Passed     = true,
                                TestStatus = TestStatusEnum.Covered
                            }
                        }
                    }
                },
                CoveragePercentage        = 1,
                NumberOfStatements        = 2,
                NumberOfMissingStatements = 0,
                NumberOfBranchesHit       = 0,
                SubmissionId = 1,
                StudentId    = "Random"
            };

            Assert.IsTrue(CompareFeedback(expected, actual));
        }
Example #27
0
 public BattleRound(IEngineFactory black, IEngineFactory white)
 {
     Black = black;
     White = white;
 }
Example #28
0
 public void Init()
 {
     Factory = new EngineFactory(CurrentDirectory);
 }
 public DevelopingPreprocessor(IEngineFactory factory)
 {
     Factory = factory;
 }
Example #30
0
 public MatchProcessor(IEngineFactory engineFactory)
 {
     this.engineFactory = engineFactory;
 }
Example #31
0
        public void FullEngineDevelopingModeShouldPassWithMultipleTest()
        {
            // Arrange
            FeedbackDto actual = new FeedbackDto();

            Factory = new MockEngineFactory(CurrentDirectory,
                                            new MockFeedback(f => actual = f));
            Engine = new Engine.PythonEngine(Factory);
            var submission = new SubmissionDto()
            {
                ApplicationMode    = "Development Mode",
                SubmissionId       = 1,
                AssignmentSolution = ConvertToZipByteArray(
                    "class Calc():\r\n" +
                    "   def add(self,x,y):\r\n" +
                    "       return x + y\r\n" +
                    "   def subt(self,x,y):\r\n" +
                    "       return x + y\r\n" +
                    "   def mult(self,x,y):\r\n" +
                    "       return x * y\r\n" +
                    "   def div(self,x,y):\r\n" +
                    "       return x / y",
                    "solution.py"),
                TestCaseSolution = ConvertToZipByteArray(
                    "import sys\r\n" +
                    "sys.path.append('../Solution/')\r\n" +
                    "from solution import Calc\r\n" +
                    "def test_add():\r\n" +
                    "   assert Calc().add(5,5) == 10\r\n" +
                    "def test_mult():\r\n" +
                    "   assert Calc().mult(1,2) == 2\r\n" +
                    "def test_two():\r\n" +
                    "   assert Calc().add(4,3) == 7\r\n" +
                    "\r\n" +
                    "def test_div():\r\n" +
                    "   assert Calc().div(8,4) == 2\r\n",
                    "test_student.py"),
                ReferenceSolution = ConvertToZipByteArray(
                    "class Calc():\r\n" +
                    "   def add(self,x,y):\r\n" +
                    "       return x + y\r\n" +
                    "   def subt(self,x,y):\r\n" +
                    "       return x - y\r\n" +
                    "   def mult(self,x,y):\r\n" +
                    "       return x * y",
                    "solution.py"),
                SolutionFolderName    = "Solution",
                ReferenceTestSolution = ConvertToZipByteArray(
                    "import sys\r\n" +
                    "sys.path.append('../Solution/')\r\n" +
                    "from solution import Calc\r\n" +
                    "class Test():\r\n" +
                    "   calculator = Calc()\r\n" +
                    "   def test_one(self,record_property):\r\n" +
                    "       record_property(\"EquivalanceClass\", \"ADDITION\")\r\n" +
                    "       record_property(\"Concepts\", \"add,pos\")\r\n" +
                    "       assert self.calculator.add(1,2) == 3\r\n" +
                    "   def test_two(self,record_property):\r\n" +
                    "       record_property(\"EquivalanceClass\", \"SUBTRACTION\")\r\n" +
                    "       record_property(\"Concepts\", \"subt,pos\")\r\n" +
                    "       assert self.calculator.subt(4,3) == 1\r\n" +
                    "   def test_three(self, record_property):\r\n" +
                    "       record_property(\"EquivalanceClass\", \"MULTIPLICATION\")\r\n" +
                    "       record_property(\"Concepts\", \"mul,pos\")\r\n" +
                    "       assert self.calculator.mult(3,3) == 9\r\n",
                    "test_teacher.py"),
            };

            // Act
            var feedbackDto = Engine.Run(submission);

            // Assert
            var expected = new FeedbackDto()
            {
                InstructorTests = new List <InstructorTestDto>()
                {
                    new InstructorTestDto()
                    {
                        Name             = "test_teacher.py::Test::test_one",
                        Concepts         = new [] { "add", "pos" },
                        EquivalenceClass = "ADDITION",
                        StudentTests     = new List <StudentTestDto>()
                        {
                            new StudentTestDto()
                            {
                                Name       = "test_student.py::test_add",
                                Passed     = true,
                                TestStatus = TestStatusEnum.Covered
                            },
                            new StudentTestDto()
                            {
                                Name       = "test_student.py::test_two",
                                Passed     = true,
                                TestStatus = TestStatusEnum.Redundant
                            }
                        }
                    },
                    new InstructorTestDto()
                    {
                        Name             = "test_teacher.py::Test::test_two",
                        Concepts         = new [] { "subt", "pos" },
                        EquivalenceClass = "SUBTRACTION",
                        TestStatus       = TestStatusEnum.Failed,
                        StudentTests     = new List <StudentTestDto>()
                    },
                    new InstructorTestDto()
                    {
                        Name             = "test_teacher.py::Test::test_three",
                        Concepts         = new [] { "mul", "pos" },
                        EquivalenceClass = "MULTIPLICATION",
                        TestStatus       = TestStatusEnum.Covered,
                        StudentTests     = new List <StudentTestDto>()
                        {
                            new StudentTestDto()
                            {
                                Name       = "test_student.py::test_mult",
                                Passed     = true,
                                TestStatus = TestStatusEnum.Covered
                            }
                        }
                    }
                },
                SubmissionId              = 1,
                CoveragePercentage        = .89,
                NumberOfStatements        = 9,
                NumberOfMissingStatements = 1,
                NumberOfBranchesHit       = 0
            };

            Assert.IsTrue(CompareFeedback(expected, actual));
        }