コード例 #1
0
ファイル: Logger.cs プロジェクト: Yndal/BDSA-Assignments
        /// <summary>
        /// Constructor
        /// Creates subscriptions to the BenchmarkSystem EventHandlers
        /// </summary>
        /// <param name="benchmark">The Benchmark containing this Logger</param>
        public Logger(BenchmarkSystem benchmark, ITM_DAO dao)
        {
            Contract.Requires(benchmark != null);
            Contract.Requires(dao != null);

            _tmDAO = dao;
            benchmark.JobSubmitted += OnJobSubmitted;
            benchmark.JobCancelled += OnJobCancelled;
            benchmark.JobRunning += OnJobRunning;
            benchmark.JobTerminated += OnJobTerminated;
            benchmark.JobFailed += OnJobFailed;
            benchmark.JobDone += OnJobDone;
        }
コード例 #2
0
        public void Test_GetJobsFromUserInPeriodOrdered()
        {
            BenchmarkSystem b = new BenchmarkSystem();
            DateTime startTime = new DateTime(2020, 1, 1);
            DateTime endTime = new DateTime(2020, 12, 31);
            User user = new User("Test User", "A secret password");

            _tmDAO.AddUser(user);
            int jobQuantity = 30;
            Job job = null;
            for (int index = 1; index <= jobQuantity; index++)
            {
                DateTime t1 = new DateTime(2020, 3, index);

                job = new Job(user, 100, 5, s => 38);
                _tmDAO.AddJob(job);
                _tmDAO.AddLog(job, t1);
                if (index % 2 == 0)
                {
                    job.Process(new String[] { "test" });
                    _tmDAO.AddLog(job, t1.AddHours(1));
                }
            }
            List<Job> jobsRequested = new List<Job>(_tmDAO.GetJobsFromUserInPeriodOrdered(user.UserId, startTime, endTime));

            for (int i = 0; i < jobsRequested.Count - 1; i++)
            {
                if (jobsRequested[i].CompareTo(jobsRequested[i + 1]) == 1)
                {
                    Assert.Fail("The order is no correct. JobId: " + jobsRequested[i] + " was larger than JobId: " + jobsRequested[i + 1]);
                }
            }

            Assert.AreEqual(jobQuantity, jobsRequested.Count);
        }
コード例 #3
0
ファイル: ConsoleUI.cs プロジェクト: Yndal/BDSA-Assignments
 /// <summary>
 /// The constructor
 /// </summary>
 public ConsoleUI()
 {
     _benchmark = new BenchmarkSystem();
     Launch();
 }
コード例 #4
0
 public void LoadBenchmarkSystem()
 {
     _b = new BenchmarkSystem();
 }
コード例 #5
0
 public BenchmarkSystem Constructor()
 {
     BenchmarkSystem target = new BenchmarkSystem();
     return target;
     // TODO: add assertions to method BenchmarkSystemTest.Constructor()
 }