Exemplo n.º 1
0
        /// <summary>
        /// the main processing method. 
        /// </summary>
        /// <param name="sysSettings"></param>
        /// <param name="assignmentSettings"></param>
        /// <param name="submitSettings"></param>
        /// <returns></returns>
        public SubmitResult Process(SystemSettings sysSettings, AssignmentSettings assignmentSettings, SubmitSettings submitSettings)
        {
            SubmitResult submitResult = new SubmitResult();

            BatchFileCreator batchfileCreator = new BatchFileCreator(sysSettings, submitSettings, _fileSystem);
            string buildFilePath = batchfileCreator.CreateBuildFile();
            string testFilePath = batchfileCreator.CreateTestFile();

            submitResult = CompileAssembly(buildFilePath, batchfileCreator.OutputLogPath);
            //in case of an error, directly return
            if (submitResult.Status == SubmitStatusCode.CompilationError)
            {
                return submitResult;
            }

            //check businessrules
            submitResult = CheckBusinessRules(batchfileCreator.OutputDllPath, assignmentSettings);
            if (submitResult.Status == SubmitStatusCode.ValidationError)
            {
                return submitResult;
            }

            submitResult = TestAssembly(batchfileCreator.BatchfileTestPath, batchfileCreator.TestLogPath);

            if (submitResult.Status == SubmitStatusCode.TestError)
            {
                return submitResult;
            }

            submitResult.Status = SubmitStatusCode.Success;

            return submitResult;
        }
Exemplo n.º 2
0
 public static SubmitSettings CreateSubmitSettings(string teamName, string teamSubmitDirName, string assignmentId)
 {
     SubmitSettings submitSettings = new SubmitSettings();
     submitSettings.TeamId = teamName;
     submitSettings.BasePath = teamSubmitDirName;
     submitSettings.TimeStamp = DateTime.Now;
     submitSettings.AssignmentId = assignmentId;
     return submitSettings;
 }
Exemplo n.º 3
0
        private void Init(SystemSettings sysSettings, SubmitSettings submitSettings, IFileSystem fileSystem)
        {
            _sysSettings    = sysSettings;
            _submitSettings = submitSettings;
            _fileSystem     = fileSystem;

            OutputDllPath        = Path.Combine(_submitSettings.BasePath, _submitSettings.GetDllName());
            SourcesPath          = Path.Combine(_submitSettings.BasePath, "*.cs");
            OutputLogPath        = Path.Combine(_submitSettings.BasePath, "build.log");
            BatchfileCompilePath = Path.Combine(submitSettings.BasePath, "buildit.bat");

            BatchfileTestPath = Path.Combine(submitSettings.BasePath, "testit.bat");
            NUnitConsolePath  = Path.Combine(sysSettings.NunitConsolePath, "nunit-console.exe");
            TestLogPath       = Path.Combine(submitSettings.BasePath, "testlog.xml");
        }
Exemplo n.º 4
0
        /// <summary>
        /// the main processing method.
        /// </summary>
        /// <param name="sysSettings"></param>
        /// <param name="assignmentSettings"></param>
        /// <param name="submitSettings"></param>
        /// <returns></returns>
        public ValidationResult Process(SystemSettings sysSettings, AssignmentSettings assignmentSettings, SubmitSettings submitSettings)
        {
            ValidationResult submitResult = new ValidationResult();

            BatchFileCreator batchfileCreator = new BatchFileCreator(sysSettings, submitSettings, _fileSystem);
            string           buildFilePath    = batchfileCreator.CreateBuildFile();
            string           testFilePath     = batchfileCreator.CreateTestFile();


            submitResult = CompileAssembly(buildFilePath, batchfileCreator.OutputLogPath);
            //in case of an error, directly return
            if (submitResult.Status == SubmitStatusCode.CompilationError)
            {
                return(submitResult);
            }

            if (!_fileSystem.FileExists(batchfileCreator.OutputDllPath))
            {
                submitResult.Status = SubmitStatusCode.CompilationError;
                return(submitResult);
            }

            //check businessrules
            submitResult = CheckBusinessRules(batchfileCreator.OutputDllPath, assignmentSettings);
            if (submitResult.Status == SubmitStatusCode.ValidationError)
            {
                return(submitResult);
            }

            submitResult = TestAssembly(batchfileCreator.BatchfileTestPath, batchfileCreator.TestLogPath);

            if (submitResult.Status == SubmitStatusCode.TestError)
            {
                return(submitResult);
            }

            submitResult.Status = SubmitStatusCode.Success;

            return(submitResult);
        }
Exemplo n.º 5
0
        private void Init(SystemSettings sysSettings, SubmitSettings submitSettings, IFileSystem fileSystem)
        {
            _sysSettings = sysSettings;
            _submitSettings = submitSettings;
            _fileSystem = fileSystem;

            OutputDllPath = Path.Combine(_submitSettings.BasePath, _submitSettings.GetDllName());
            SourcesPath = Path.Combine(_submitSettings.BasePath, "*.cs");
            OutputLogPath = Path.Combine(_submitSettings.BasePath, "build.log");
            BatchfileCompilePath = Path.Combine(submitSettings.BasePath, "buildit.bat");

            BatchfileTestPath = Path.Combine(submitSettings.BasePath, "testit.bat");
            NUnitConsolePath = Path.Combine(sysSettings.NunitConsolePath, "nunit-console.exe");
            TestLogPath = Path.Combine(submitSettings.BasePath, "testlog.xml");
        }
Exemplo n.º 6
0
 public BatchFileCreator(SystemSettings sysSettings, SubmitSettings submitSettings, IFileSystem fileSystem)
 {
     Init(sysSettings, submitSettings, fileSystem);
 }
Exemplo n.º 7
0
 public BatchFileCreator(SystemSettings sysSettings, SubmitSettings submitSettings, IFileSystem fileSystem)
 {
     Init(sysSettings, submitSettings, fileSystem);
 }