ScientificReport
TestData.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
7 
8 namespace ScientificReport.Test
9 {
10  public static class TestData
11  {
12  public static readonly UserProfile User1 = new UserProfile
13  {
14  Id = Guid.NewGuid(),
15  Email = "email1@gmail.com",
16  Position = "Some position1",
17  LastName = "LastName1",
18  UserName = "User_name_1",
19  BirthYear = 1991,
20  FirstName = "FirstName1",
21  IsApproved = true,
22  MiddleName = "MiddleName1",
23  PhoneNumber = "+380000000001",
24  };
25  public static readonly UserProfile User2 = new UserProfile
26  {
27  Id = Guid.NewGuid(),
28  Email = "email2@gmail.com",
29  Position = "Some position2",
30  LastName = "LastName2",
31  UserName = "User_name_2",
32  BirthYear = 1992,
33  FirstName = "FirstName2",
34  IsApproved = true,
35  MiddleName = "MiddleName2",
36  PhoneNumber = "+380000000002",
37  };
38  public static readonly UserProfile User3 = new UserProfile
39  {
40  Id = Guid.NewGuid(),
41  Email = "email3@gmail.com",
42  Position = "Some position3",
43  LastName = "LastName3",
44  UserName = "User_name_3",
45  BirthYear = 1993,
46  FirstName = "FirstName3",
47  IsApproved = true,
48  MiddleName = "MiddleName3",
49  PhoneNumber = "+380000000003",
50  };
51 
52  public static readonly ScientificWork ScientificWork1 = new ScientificWork
53  {
54  Id = Guid.NewGuid(),
55  Title = "Scientific Work 1",
56  Cypher = "6546ttt7",
57  Category = "Category 1",
58  Contents = "Some content 1"
59  };
60  public static readonly ScientificWork ScientificWork2 = new ScientificWork
61  {
62  Id = Guid.NewGuid(),
63  Title = "Scientific Work 2",
64  Cypher = "jhg567th",
65  Category = "Category 2",
66  Contents = "Some content 2"
67  };
68  public static readonly ScientificWork ScientificWork3 = new ScientificWork
69  {
70  Id = Guid.NewGuid(),
71  Title = "Scientific Work 3",
72  Cypher = "8765rfgh",
73  Category = "Category 3",
74  Contents = "Some content 3"
75  };
76 
77  public static readonly Publication Publication1 = new Publication
78  {
79  Id = Guid.NewGuid(),
80  PublicationType = Publication.PublicationTypes.Comment,
81  Title = "Publication 1",
82  Specification = "Specification 1",
83  PagesAmount = 10,
84  PublishingYear = 2007,
85  PublishingPlace = "Publishing Place 1",
86  PublishingHouseName = "Publishing House Name 1",
87  PrintStatus = Publication.PrintStatuses.IsRecommendedToPrint
88  };
89  public static readonly Publication Publication2 = new Publication
90  {
91  Id = Guid.NewGuid(),
92  PublicationType = Publication.PublicationTypes.Monograph,
93  Title = "Publication 2",
94  Specification = "Specification 2",
95  PagesAmount = 20,
96  PublishingYear = 2014,
97  PublishingPlace = "Publishing Place 2",
98  PublishingHouseName = "Publishing House Name 2",
99  PrintStatus = Publication.PrintStatuses.IsPrintCanceled
100  };
101  public static readonly Publication Publication3 = new Publication
102  {
103  Id = Guid.NewGuid(),
104  PublicationType = Publication.PublicationTypes.Dictionary,
105  Title = "Publication 3",
106  Specification = "Specification 3",
107  PagesAmount = 30,
108  PublishingYear = 2007,
109  PublishingPlace = "Publishing Place 3",
110  PublishingHouseName = "Publishing House Name 3",
111  PrintStatus = Publication.PrintStatuses.Any
112  };
113 
114  public static readonly Department Department1 = new Department
115  {
116  Id = Guid.NewGuid(),
117  Head = User1,
118  Staff = new List<UserProfile>
119  {
120  User1, User2
121  },
122  Title = "Some title 1",
123  ScientificWorks = new List<ScientificWork>
124  {
125  ScientificWork1
126  }
127  };
128  public static readonly Department Department2 = new Department
129  {
130  Id = Guid.NewGuid(),
131  Head = User2,
132  Staff = new List<UserProfile>
133  {
134  User2, User3
135  },
136  Title = "Some title 2",
137  ScientificWorks = new List<ScientificWork>
138  {
139  ScientificWork2,
140  }
141  };
142  public static readonly Department Department3 = new Department
143  {
144  Id = Guid.NewGuid(),
145  Head = User3,
146  Staff = new List<UserProfile>
147  {
148  User1, User2, User3
149  },
150  Title = "Some title 3",
151  ScientificWorks = new List<ScientificWork>
152  {
153  ScientificWork3
154  }
155  };
156 
157  public static readonly Membership Membership1 = new Membership
158  {
159  Id = Guid.NewGuid(),
160  Type = Membership.Types.ExpertCouncil,
161  MembershipInfo = "Some membership info 1",
162  User = User1
163  };
164  public static readonly Membership Membership2 = new Membership
165  {
166  Id = Guid.NewGuid(),
167  Type = Membership.Types.EditorialBoard,
168  MembershipInfo = "Some membership info 2",
169  User = User1
170  };
171  public static readonly Membership Membership3 = new Membership
172  {
173  Id = Guid.NewGuid(),
174  Type = Membership.Types.ScientificCouncil,
175  MembershipInfo = "Some membership info 3"
176  };
177 
178  public static readonly Opposition Opposition1 = new Opposition
179  {
180  Id = Guid.NewGuid(),
181  Opponent = User1,
182  About = "About info 1",
183  DateOfOpposition = DateTime.Today
184  };
185  public static readonly Opposition Opposition2 = new Opposition
186  {
187  Id = Guid.NewGuid(),
188  Opponent = User1,
189  About = "About info 2",
190  DateOfOpposition = DateTime.Today
191  };
192  public static readonly Opposition Opposition3 = new Opposition
193  {
194  Id = Guid.NewGuid(),
195  Opponent = User3,
196  About = "About info 3",
197  DateOfOpposition = DateTime.Today
198  };
199 
200  public static readonly Article Article1 = new Article
201  {
202  Id = Guid.NewGuid(),
203  Title = "Some title 1",
204  IsPrintCanceled = true,
205  UserProfilesArticles = null,
206  ArticleType = Article.ArticleTypes.ReportThesis,
207  Number = 1,
208  PagesAmount = 20,
209  DocumentInfo = "Some document info 1",
210  IsPeriodical = true,
211  LiabilityInfo = "Some liability info 1",
212  PublishingYear = 2003,
213  PublishingPlace = "Some place 1",
214  PublishingHouseName = "Some house name 1",
215  IsRecommendedToPrint = false
216  };
217  public static readonly Article Article2 = new Article
218  {
219  Id = Guid.NewGuid(),
220  Title = "Some title 2",
221  IsPrintCanceled = true,
222  UserProfilesArticles = null,
223  ArticleType = Article.ArticleTypes.ForeignPublishing,
224  Number = 0,
225  PagesAmount = 30,
226  DocumentInfo = "Some document info 2",
227  IsPeriodical = false,
228  LiabilityInfo = "Some liability info 2",
229  PublishingYear = 2004,
230  PublishingPlace = "Some place 2",
231  PublishingHouseName = "Some house name 2",
232  IsRecommendedToPrint = false
233  };
234  public static readonly Article Article3 = new Article
235  {
236  Id = Guid.NewGuid(),
237  Title = "Some title 3",
238  IsPrintCanceled = false,
239  UserProfilesArticles = null,
240  ArticleType = Article.ArticleTypes.OtherPublishingOfUkraine,
241  Number = 2,
242  PagesAmount = 10,
243  DocumentInfo = "Some document info 3",
244  IsPeriodical = true,
245  LiabilityInfo = "Some liability info 3",
246  PublishingYear = 2005,
247  PublishingPlace = "Some place 3",
248  PublishingHouseName = "Some house name 3",
249  IsRecommendedToPrint = true
250  };
251 
252  public static readonly Grant Grant1 = new Grant
253  {
254  Id = Guid.NewGuid()
255  };
256  public static readonly Grant Grant2 = new Grant
257  {
258  Id = Guid.NewGuid()
259  };
260  public static readonly Grant Grant3 = new Grant
261  {
262  Id = Guid.NewGuid()
263  };
264 
265  public static readonly Conference Conference1 = new Conference
266  {
267  Id = Guid.NewGuid(),
268  Date = DateTime.Now,
269  Topic = "Some topic 1"
270  };
271  public static readonly Conference Conference2 = new Conference
272  {
273  Id = Guid.NewGuid(),
274  Date = DateTime.Now,
275  Topic = "Some topic 2"
276  };
277  public static readonly Conference Conference3 = new Conference
278  {
279  Id = Guid.NewGuid(),
280  Date = DateTime.Now,
281  Topic = "Some topic 3"
282  };
283 
284  public static readonly PatentLicenseActivity PatentLicenseActivity1 = new PatentLicenseActivity
285  {
286  Id = Guid.NewGuid(),
287  Name = "Some name 1",
288  Type = PatentLicenseActivity.Types.Patent,
289  Number = 1,
290  Date = DateTime.Now,
291  };
292  public static readonly PatentLicenseActivity PatentLicenseActivity2 = new PatentLicenseActivity
293  {
294  Id = Guid.NewGuid(),
295  Name = "Some name 2",
296  Type = PatentLicenseActivity.Types.Patent,
297  Number = 2,
298  Date = DateTime.Now
299  };
300  public static readonly PatentLicenseActivity PatentLicenseActivity3 = new PatentLicenseActivity
301  {
302  Id = Guid.NewGuid(),
303  Name = "Some name 3",
304  Type = PatentLicenseActivity.Types.Patent,
305  Number = 3,
306  Date = DateTime.Now
307  };
308 
309  public static readonly Review Review1 = new Review
310  {
311  Id = Guid.NewGuid(),
312  Work = Publication1,
313  DateOfReview = DateTime.Today
314  };
315  public static readonly Review Review2 = new Review
316  {
317  Id = Guid.NewGuid(),
318  Work = Publication2,
319  DateOfReview = DateTime.Today
320  };
321  public static readonly Review Review3 = new Review
322  {
323  Id = Guid.NewGuid(),
324  Work = Publication3,
325  DateOfReview = DateTime.Today
326  };
327 
328  public static readonly PostgraduateGuidance PostgraduateGuidance1 = new PostgraduateGuidance
329  {
330  Id = Guid.NewGuid(),
331  Guide = User1,
332  PostgraduateInfo = "Postgraduate Info 1",
333  PostgraduateName = "Postgraduate Name 1"
334  };
335  public static readonly PostgraduateGuidance PostgraduateGuidance2 = new PostgraduateGuidance
336  {
337  Id = Guid.NewGuid(),
338  Guide = User2,
339  PostgraduateInfo = "Postgraduate Info 2",
340  PostgraduateName = "Postgraduate Name 2"
341  };
342  public static readonly PostgraduateGuidance PostgraduateGuidance3 = new PostgraduateGuidance
343  {
344  Id = Guid.NewGuid(),
345  Guide = User3,
346  PostgraduateInfo = "Postgraduate Info 3",
347  PostgraduateName = "Postgraduate Name 3"
348  };
349 
350  public static readonly PostgraduateDissertationGuidance PostgraduateDissertationGuidance1 =
352  {
353  Id = Guid.NewGuid(),
354  Guide = User1,
355  GraduationYear = 2001,
356  PostgraduateName = "Postgraduate Name 1",
357  Speciality = "Speciality 1",
358  Dissertation = "Dissertation 1",
359  DateDegreeGained = DateTime.Now
360  };
361  public static readonly PostgraduateDissertationGuidance PostgraduateDissertationGuidance2 =
363  {
364  Id = Guid.NewGuid(),
365  Guide = User2,
366  GraduationYear = 2002,
367  PostgraduateName = "Postgraduate Name 2",
368  Speciality = "Speciality 2",
369  Dissertation = "Dissertation 2",
370  DateDegreeGained = DateTime.Now
371  };
372  public static readonly PostgraduateDissertationGuidance PostgraduateDissertationGuidance3 =
374  {
375  Id = Guid.NewGuid(),
376  Guide = User3,
377  GraduationYear = 2003,
378  PostgraduateName = "Postgraduate Name 3",
379  Speciality = "Speciality 3",
380  Dissertation = "Dissertation 3",
381  DateDegreeGained = DateTime.Now
382  };
383 
384  public static readonly ScientificInternship ScientificInternship1 = new ScientificInternship
385  {
386  Id = Guid.NewGuid(),
387  Contents = "Some content 1",
388  Ended = DateTime.Now,
389  Started = DateTime.Now,
390  PlaceOfInternship = "Some place 1"
391  };
392  public static readonly ScientificInternship ScientificInternship2 = new ScientificInternship
393  {
394  Id = Guid.NewGuid(),
395  Contents = "Some content 2",
396  Ended = DateTime.Now,
397  Started = DateTime.Now,
398  PlaceOfInternship = "Some place 2"
399  };
400  public static readonly ScientificInternship ScientificInternship3 = new ScientificInternship
401  {
402  Id = Guid.NewGuid(),
403  Contents = "Some content 3",
404  Ended = DateTime.Now,
405  Started = DateTime.Now,
406  PlaceOfInternship = "Some place 3"
407  };
408 
409  public static readonly ScientificConsultation ScientificConsultation1 = new ScientificConsultation
410  {
411  Id = Guid.NewGuid(),
412  CandidateName = "Some name 1",
413  Guide = User1,
414  DissertationTitle = "Dissertation Title 1"
415  };
416  public static readonly ScientificConsultation ScientificConsultation2 = new ScientificConsultation
417  {
418  Id = Guid.NewGuid(),
419  CandidateName = "Some name 2",
420  Guide = User2,
421  DissertationTitle = "Dissertation Title 2"
422  };
423  public static readonly ScientificConsultation ScientificConsultation3 = new ScientificConsultation
424  {
425  Id = Guid.NewGuid(),
426  CandidateName = "Some name 3",
427  Guide = User3,
428  DissertationTitle = "Dissertation Title 3"
429  };
430 
431  public static readonly ReportThesis ReportThesis1 = new ReportThesis
432  {
433  Id = Guid.NewGuid(),
434  Conference = Conference1,
435  Thesis = "Some thesis 1",
436  };
437  public static readonly ReportThesis ReportThesis2 = new ReportThesis
438  {
439  Id = Guid.NewGuid(),
440  Conference = Conference1,
441  Thesis = "Some thesis 2"
442  };
443  public static readonly ReportThesis ReportThesis3 = new ReportThesis
444  {
445  Id = Guid.NewGuid(),
446  Conference = Conference3,
447  Thesis = "Some thesis 3"
448  };
449 
450  public static readonly TeacherReport TeacherReport1 = new TeacherReport
451  {
452  Id = Guid.NewGuid(),
453  Edited = DateTime.Now,
454 
455  Created = DateTime.Now,
456  Teacher = User1,
457  };
458  public static readonly TeacherReport TeacherReport2 = new TeacherReport
459  {
460  Id = Guid.NewGuid(),
461  Edited = DateTime.Now,
462 
463  Created = DateTime.Now,
464  Teacher = User2,
465  };
466  public static readonly TeacherReport TeacherReport3 = new TeacherReport
467  {
468  Id = Guid.NewGuid(),
469  Edited = DateTime.Now,
470 
471  Created = DateTime.Now,
472  Teacher = User3,
473 
474  };
475 
476  public static readonly DepartmentReport DepartmentReport1 = new DepartmentReport
477  {
478  Id = Guid.NewGuid(),
479  Created = DateTime.Now,
480  Edited = DateTime.Now,
481  HeadOfDepartment = User1,
482  Conferences = new List<Conference>
483  {
484  Conference1
485  },
486  TeacherReports = new List<TeacherReport>
487  {
488  TeacherReport1, TeacherReport2
489  }
490  };
491  public static readonly DepartmentReport DepartmentReport2 = new DepartmentReport
492  {
493  Id = Guid.NewGuid(),
494  Created = DateTime.Now,
495  Edited = DateTime.Now,
496  HeadOfDepartment = User2,
497  Conferences = new List<Conference>
498  {
499  Conference2
500  },
501  TeacherReports = new List<TeacherReport>
502  {
503  TeacherReport1, TeacherReport3
504  }
505  };
506  public static readonly DepartmentReport DepartmentReport3 = new DepartmentReport
507  {
508  Id = Guid.NewGuid(),
509  Created = DateTime.Now,
510  Edited = DateTime.Now,
511  HeadOfDepartment = User3,
512  Conferences = new List<Conference>
513  {
514  Conference3
515  },
516  TeacherReports = new List<TeacherReport>
517  {
518  TeacherReport2
519  }
520  };
521 
522  public static readonly FacultyReport FacultyReport1 = new FacultyReport
523  {
524  Id = Guid.NewGuid(),
525  Administrator = User1,
526  Edited = DateTime.Now,
527  Created = DateTime.Now,
528  DepartmentReports = new List<DepartmentReport>
529  {
530  DepartmentReport1, DepartmentReport2
531  }
532  };
533  public static readonly FacultyReport FacultyReport2 = new FacultyReport
534  {
535  Id = Guid.NewGuid(),
536  Administrator = User2,
537  Edited = DateTime.Now,
538  Created = DateTime.Now,
539  DepartmentReports = new List<DepartmentReport>
540  {
541  DepartmentReport1
542  }
543  };
544  public static readonly FacultyReport FacultyReport3 = new FacultyReport
545  {
546  Id = Guid.NewGuid(),
547  Administrator = User3,
548  Edited = DateTime.Now,
549  Created = DateTime.Now,
550  DepartmentReports = new List<DepartmentReport>
551  {
552  DepartmentReport3, DepartmentReport2
553  }
554  };
555 
556  private static readonly Random TestRand = new Random();
557 
558  private static readonly string[] TestWords =
559  {
560  "Lorem", "Ipsum", "Dolor", "Sit", "Amet", "Consectetuer",
561  "Adipiscing", "Elit", "Sed", "Diam", "Nonummy", "Nibh", "Euismod",
562  "Tincidunt", "Ut", "Laoreet", "Dolore", "Magna", "Aliquam", "Erat"
563  };
564 
565  private static string RandWord()
566  {
567  return TestWords[TestRand.Next(TestWords.Length)];
568  }
569 
570  private static string RandText(int wordsNumber)
571  {
572  var text = "";
573  for (var i = 0; i < wordsNumber; i++)
574  {
575  text += RandWord() + " ";
576  }
577 
578  return text;
579  }
580 
581  private static bool RandBool()
582  {
583  return TestRand.Next(2) == 1;
584  }
585 
586  public static UserProfile RandUser(bool setApproved = false)
587  {
588  var fName = RandWord();
589  var lName = RandWord();
590  var uName = $"{fName.ToLower()}_{lName.ToLower()}";
591  return new UserProfile
592  {
593  Id = Guid.NewGuid(),
594  Email = $"{uName}@email.com",
595  Position = RandWord(),
596  LastName = lName,
597  UserName = uName,
598  BirthYear = TestRand.Next(1920, 1996),
599  FirstName = fName,
600  IsApproved = setApproved || RandBool(),
601  MiddleName = "MiddleName",
602  PhoneNumber = $"+380{TestRand.Next(100000000, 999999999)}",
603  };
604  }
605 
606  public static ScientificWork RandScientificWork()
607  {
608  return new ScientificWork
609  {
610  Id = Guid.NewGuid(),
611  Title = RandText(3),
612  Cypher = TestRand.Next(100000, 99999).ToString(),
613  Category = RandWord(),
614  Contents = RandText(7)
615  };
616  }
617 
618  public static Publication RandPublication()
619  {
620  Publication.PrintStatuses printStatus;
621  switch (TestRand.Next(2))
622  {
623  case 1:
624  printStatus = Publication.PrintStatuses.IsPrintCanceled;
625  break;
626  case 2:
627  printStatus = Publication.PrintStatuses.IsRecommendedToPrint;
628  break;
629  default:
630  printStatus = Publication.PrintStatuses.Any;
631  break;
632  }
633  return new Publication
634  {
635  Id = Guid.NewGuid(),
636  PublicationType = Publication.PublicationTypes.Comment,
637  Title = RandText(3),
638  Specification = RandWord(),
639  PagesAmount = TestRand.Next(3, 100),
640  PublishingYear = TestRand.Next(1990, 2018),
641  PublishingPlace = RandText(4),
642  PublishingHouseName = RandText(4),
643  PrintStatus = printStatus
644  };
645  }
646  }
647 }