//Конструктор копирования public WaterObject(WaterObject o2) : this(o2.Name, o2.Type, o2.Region, o2.Depth, o2.Area, o2.EditionalData) { this.Image = o2.Image; }
//Заполение иесиовыми данными public void FillTestData(int n) { //Пользователи Users = new List <CommonUser>(); for (int i = 0; i < n; ++i) { Users.Add(new CommonUser($"User{i}", $"password{i}")); } //Статьи Articles = new List <WaterObject>(); List <string> commonTypes = new List <string> { "Река", "Водохранилище", "Озеро", "Болото", "Море", "Пролив", "Залив" }; List <string> commonRegions = new List <string> { "Европа", "Азия", "Африка", "Северная Америка", "Южная Америка", "Австралия", "-" }; for (int i = 0; i < n; ++i) { var temp = new WaterObject($"Water{i}", $"{commonTypes[(i/10)%commonTypes.Count]}", $"{commonRegions[(i)%commonRegions.Count]}", i * 10, i * 100, $"Some editional data"); temp.Image = DAO.LoadTestImage(temp.Type); Articles.Add(temp); } //тестами Tests = new List <Test>(); const int NuberOfQuestions = 5; const int NuberOfOptions = 6; for (int i = 0; i < n; ++i) { var questions = new List <Question>(); for (int j = 0; j < NuberOfQuestions; ++j) { var options = new List <QuestionOp>(); for (int k = 0; k < NuberOfOptions; ++k) { options.Add(new QuestionOp($"Option{k}")); } questions.Add(new Question($"Text of question {j}", options[j % NuberOfOptions], j, options)); } Tests.Add(new Test($"Test{i}", questions)); } }