public async Task GetTeachersInRange_CorrectData_Teachers() { const int startId = 22000; const int endId = 22100; const int diff = endId - startId; var timeout = TimeSpan.FromSeconds(5); var service = new TeachersParser(timeout); using (var httpTest = new HttpTest()) { httpTest.RespondWith(await File.ReadAllTextAsync("TestData/Schedule/teachers.txt")); var result = await service.GetTeachersInRange(startId, endId, 1, 1); var first = result.First(); httpTest.ShouldHaveCalled(Constants.EndPoint) .WithVerb(HttpMethod.Get) .Times(diff); result.Should().NotBeEmpty().And .HaveCount(1); first.Depart.Should().Be("Кафедра теоретической и прикладной химии"); first.Id.Should().Be(22000); first.Name.Should().Be("Богданов Михаил Владиславович"); } }
static async Task Main(string[] args) { var timeout = TimeSpan.FromSeconds(5); var teacherSchedule = new TeachersSchedule(timeout); var teacherLessons = await teacherSchedule.GetLessons(22914); var studentsSchedule = new StudentsSchedule(timeout); var studentsLessons = await studentsSchedule.GetLessons(9092); var schoolsParser = new SchoolsParser(timeout); var schools = await schoolsParser.GetSchools(); var groupsParser = new GroupsParser(timeout); var groups = await groupsParser.GetGroupsFromSchool(15); var teachersParser = new TeachersParser(timeout); var teachers = await teachersParser.GetTeachersInRange(22913, 22917, 3, 1000); Console.ReadLine(); }
public async void GetTeachersInRange_CorrectData_Teachers() { const int startId = 22000; const int endId = 22100; const int diff = endId - startId; var timeout = TimeSpan.FromSeconds(5); var service = new TeachersParser(timeout); using (var httpTest = new HttpTest()) { httpTest.RespondWith(File.ReadAllText("TestData/Schedule/teachers.txt")); var result = await service.GetTeachersInRange(startId, endId, 1, 1); httpTest.ShouldHaveCalled(Constants.EndPoint) .WithVerb(HttpMethod.Get) .Times(diff); Assert.NotEmpty(result); } }
public ParserService(TimeSpan timeout) { Groups = new GroupsParser(timeout); Teachers = new TeachersParser(timeout); Schools = new SchoolsParser(timeout); }