Beispiel #1
0
        private Report CreateReport(string path)
        {
            var report = new Report(path, true);

            foreach (var category in _categories)
            {
                report.AddCategory(category);
                report.AddDisciplines(category.Disciplines);
            }
            return(report);
        }
        public void AddDisciplines_Doesnt_Throw_Exception()
        {
            var rnd = new Random(DateTime.Now.Millisecond);
            List <Discipline> discs = new List <Discipline>();

            for (var i = 0; i < _names.Length; i++)
            {
                var disc = new Discipline
                {
                    Index         = $"ОУД{i:00}",
                    Title         = _names[i],
                    MaxLoad       = rnd.Next(20, 100),
                    SelfGuided    = rnd.Next(20, 100),
                    StatutoryLoad = new StatutoryLoad
                    {
                        Total = rnd.Next(200, 500),
                        LIZWithoutDivision = rnd.Next(10, 35),
                        LIZWithDivision    = rnd.Next(50, 60)
                    }
                };
                for (var j = 0; j < disc.MidtermAssessment.Length; j++)
                {
                    var index = rnd.Next(_assessement.Length);
                    disc.MidtermAssessment[j] = _assessement[index];
                }
                for (var j = 0; j < disc.WorkloadDistribution.Length; j++)
                {
                    disc.WorkloadDistribution[j] = rnd.Next(50);
                }
                discs.Add(disc);
            }

            try
            {
                _report.AddDisciplines(discs);
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }