|
| 1 | +using Newtonsoft.Json; |
| 2 | +using System; |
| 3 | +using System.Collections.Generic; |
| 4 | +using System.Linq; |
| 5 | +using System.Text; |
| 6 | +using System.Threading.Tasks; |
| 7 | +using WebUntisAPI.Client.Models; |
| 8 | +using static API.Test.AuthentificationTests; |
| 9 | + |
| 10 | +namespace API.Test; |
| 11 | + |
| 12 | +[TestFixture] |
| 13 | +internal class TimeTableTests |
| 14 | +{ |
| 15 | + [Test] |
| 16 | + public void GetStatusData() |
| 17 | + { |
| 18 | + Client.LoginAsync(s_Server, s_LoginName, s_UserName, s_Password).Wait(); |
| 19 | + |
| 20 | + Task<StatusData> status = Client.GetStatusDataAsync(); |
| 21 | + status.Wait(); |
| 22 | + if (status.Result != null) |
| 23 | + Assert.Pass(); |
| 24 | + else |
| 25 | + Assert.Fail(); |
| 26 | + } |
| 27 | + |
| 28 | + [Test] |
| 29 | + public void GetTimeGrid() |
| 30 | + { |
| 31 | + Client.LoginAsync(s_Server, s_LoginName, s_UserName, s_Password).Wait(); |
| 32 | + |
| 33 | + Task<Timegrid> timegrid = Client.GetTimegridAsync(); |
| 34 | + timegrid.Wait(); |
| 35 | + if (timegrid.Result.SchoolDayCount > 0) |
| 36 | + Assert.Pass(); |
| 37 | + else |
| 38 | + Assert.Fail(); |
| 39 | + } |
| 40 | + |
| 41 | + [Test] |
| 42 | + public void GetSchoolYears() |
| 43 | + { |
| 44 | + Client.LoginAsync(s_Server, s_LoginName, s_UserName, s_Password).Wait(); |
| 45 | + |
| 46 | + Task<SchoolYear[]> schoolYears = Client.GetAllSchoolYearsAsync(); |
| 47 | + schoolYears.Wait(); |
| 48 | + if (schoolYears.Result.Length > 0) |
| 49 | + Assert.Pass(); |
| 50 | + else |
| 51 | + Assert.Fail(); |
| 52 | + } |
| 53 | + |
| 54 | + [Test] |
| 55 | + public void GetCurrentSchoolYear() |
| 56 | + { |
| 57 | + Client.LoginAsync(s_Server, s_LoginName, s_UserName, s_Password).Wait(); |
| 58 | + |
| 59 | + Task<SchoolYear> schoolYear = Client.GetCurrentSchoolYearAsync(); |
| 60 | + schoolYear.Wait(); |
| 61 | + if (schoolYear.Result != null) |
| 62 | + Assert.Pass(); |
| 63 | + else |
| 64 | + Assert.Fail(); |
| 65 | + } |
| 66 | + |
| 67 | + [Test] |
| 68 | + public void GetHolidays() |
| 69 | + { |
| 70 | + Client.LoginAsync(s_Server, s_LoginName, s_UserName, s_Password).Wait(); |
| 71 | + |
| 72 | + Task<Holidays[]> holidays = Client.GetAllHolidaysAsync(); |
| 73 | + holidays.Wait(); |
| 74 | + if (holidays.Result.Length > 0) |
| 75 | + Assert.Pass(); |
| 76 | + else |
| 77 | + Assert.Fail(); |
| 78 | + } |
| 79 | + |
| 80 | + [Test] |
| 81 | + public void GetTimetable() |
| 82 | + { |
| 83 | + Client.LoginAsync(s_Server, s_LoginName, s_UserName, s_Password).Wait(); |
| 84 | + |
| 85 | + Task<Period[]> timetable = Client.GetTimetableForStudentAsync(Client.User as Student, new DateTime(2023, 05, 29), new DateTime(2023, 09, 2)); |
| 86 | + timetable.Wait(); |
| 87 | + if (timetable.Result.Length > 0) |
| 88 | + Assert.Pass(); |
| 89 | + else |
| 90 | + Assert.Fail(); |
| 91 | + } |
| 92 | +} |
0 commit comments