public void Restart(string testSessionUuId) { IsStoped = false; TestIsFound = false; CheckedDocumentsCount = 0; TestSessionUuId = testSessionUuId; testSession = client.GetTestSession(testSessionUuId); startId = GetStartTestDocumentId(testSession); if (testSession.Questions.Count != testSession.TestQuestionsCount) { throw new AnsweredQuestionException(); } InitializeFinders(); foreach (var finder in testDocumentFinders) { finder.Start(); } IsStoped = false; specialCasesTask = new Task(CheckSpecialCases); specialCasesTask.Start(); }
public FinderSystem(NaUrokClient client, string testSessionUuId, int threadsCount, int finderIterationsCount) { if (client is null) { throw new ArgumentNullException(nameof(client)); } testDocumentFinders = new List <TestDocumentFinder>(); this.client = client; ThreadsCount = threadsCount; FinderIterationsCount = finderIterationsCount; TestSessionUuId = testSessionUuId; testSession = client.GetTestSession(testSessionUuId); }
private bool IsCorrectSolvedSession(SolvedTestSession solvedSession) { if (solvedSession is null) { return(false); } var naUrokAccount = context.WebSitesAccounts.First(account => account.WebSite == "https://naurok.com.ua"); var naUrokClient = new NaUrokClient(naUrokAccount.Login, naUrokAccount.Password); TestSession testSession; try { testSession = naUrokClient.GetTestSession(solvedSession.Id); } catch (Exception) { return(false); } return(naUrokClient.IsCorrectTestDocument(testSession, solvedSession.TestDocumentId, out _)); }