Пример #1
0
        public int Refresh()
        {
            ParserRutor      parserRutor = new ParserRutor();
            List <FoundPost> foundPosts  = parserRutor.GetList();

            DataBaseControl  dataBase      = new DataBaseControl();
            List <FoundPost> oldFoundPosts = dataBase.GetLastFounded(TTrakers.Rutor, 500);

            foundPosts = parserRutor.DeleteDuplicateFromList(oldFoundPosts, foundPosts);
            List <ReadyPost> readyPosts = parserRutor.GetItems(foundPosts);

            int result = dataBase.AddReady(readyPosts);

            return(result);
        }
        public void AddReadyTest()
        {
            autoParsingContext db        = new autoParsingContext();
            FoundPost          foundPost = db.FoundPost.First();
            ReadyPost          readyPost = null;
            bool eventCall = false;

            ParserRutor parserRutor = new ParserRutor();

            parserRutor.ReadyPostsReceived += delegate(object s, ReadyPostArgs e)
            {
                readyPost = e.ReadyPostRecieved;
                eventCall = true;
            };
            parserRutor.StartGetItem(foundPost);
            CommonFunction.SleepTimer(12, ref eventCall);

            DataBaseControl dataBaseControl = new DataBaseControl();

            Assert.IsNotNull(readyPost);
            int actual = dataBaseControl.AddReady(readyPost);

            Assert.AreEqual(9, actual);
        }