Beispiel #1
0
        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();
        }
Beispiel #2
0
        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 _));
        }