Example #1
0
        public void GenerateOneBencharkInstance_JobParametersList_LengthIsCorrect()
        {
            IGenerationArgs generationArgsMock = Mock.Of <IGenerationArgs>(generationArgs =>
                                                                           generationArgs.NumberOfJobs == 10);

            BenchmarkInstance bi = BPMGeneratorMethods.GenerateOneBencharkInstance(generationArgsMock);

            bi.JobsList.Should().HaveCount(generationArgsMock.NumberOfJobs);
        }
Example #2
0
        public void GenerateOneBencharkInstance_NumberOfJobs_ValueIsCorrect()
        {
            IGenerationArgs generationArgsMock = Mock.Of <IGenerationArgs>(generationArgs =>
                                                                           generationArgs.NumberOfJobs == 10);

            BenchmarkInstance bi = BPMGeneratorMethods.GenerateOneBencharkInstance(generationArgsMock);

            bi.NumberOfJobs.Should().Be(generationArgsMock.NumberOfJobs);
        }
Example #3
0
        public void GenerateOneBencharkInstance_MachineCapacity_ValueIsCorrect()
        {
            IGenerationArgs generationArgsMock = Mock.Of <IGenerationArgs>(generationArgs =>
                                                                           generationArgs.MachineCapacity == 55);

            BenchmarkInstance bi = BPMGeneratorMethods.GenerateOneBencharkInstance(generationArgsMock);

            bi.MachineCapacity.Should().Be(generationArgsMock.MachineCapacity);
        }
Example #4
0
        public void GenerateJobParameters_JobSize_RangeIsCorrect()
        {
            int             idx = 2;
            IGenerationArgs generationArgsMock = Mock.Of <IGenerationArgs>(generationArgs =>
                                                                           generationArgs.JobSizeFrom == 55 &&
                                                                           generationArgs.JobSizeTo == 60
                                                                           );

            JobParameters jb = BPMGeneratorMethods.GenerateJobParameters(idx, generationArgsMock);

            jb.JobSize.Should().BeInRange(generationArgsMock.JobSizeFrom, generationArgsMock.JobSizeTo);
        }
        public static BenchmarkInstance GenerateOneBencharkInstance(IGenerationArgs igenArgs)
        {
            List <JobParameters> jp = new List <JobParameters>();

            try
            {
                for (int i = 0; i < igenArgs.NumberOfJobs; i++)
                {
                    jp.Add(GenerateJobParameters(i, igenArgs));
                }
            }
            catch (ArgumentOutOfRangeException)
            {
                throw new ArgumentOutOfRangeException("Job processing or job size values are not in order. Check Customize tab.");
            }

            string instanceName = "J" + igenArgs.NumberOfJobs.ToString() +
                                  "p" + igenArgs.JobProcessingTimeFrom + igenArgs.JobProcessingTimeTo +
                                  "s" + igenArgs.JobSizeFrom + igenArgs.JobSizeTo;

            BenchmarkInstance instance = new BenchmarkInstance(igenArgs.NumberOfJobs, igenArgs.MachineCapacity, instanceName, jp);

            return(instance);
        }
 public static JobParameters GenerateJobParameters(int index, IGenerationArgs igArgs)
 {
     return(new JobParameters(index, r.Next(igArgs.JobProcessingTimeFrom, igArgs.JobProcessingTimeTo),
                              r.Next(igArgs.JobSizeFrom, igArgs.JobSizeTo)));
 }