Ejemplo n.º 1
0
        public void AnimatedSelectorWithExcludeLast_SelectImage_ArrayOneItem_Result()
        {
            var img = new db.AnimatedImage
            {
                BlobName  = "test:slug",
                TweetDate = null
            };

            var imgs = new db.AnimatedImage[] { img };

            var selector = new AnimatedSelectorWithExcludeLast();
            var result   = selector.SelectImage(imgs);

            Assert.AreSame(img, result, "Очікувалось повернення об'єкту img");
        }
Ejemplo n.º 2
0
        public void LastTweetUpdater_ForPage_And_Animated_Test()
        {
            //тест дата твита
            var dtNow1 = new DateTime(2020, 10, 14, 0, 0, 0);

            var nowDate = new SelectLogic.Stubs.DateSupplyStub
            {
                Now = dtNow1
            };

            var animatedTweetDateUpdaterStub = new Stubs.AnimatedTweetDateUpdaterStub
            {
                DontThrowNotImpl = true
            };


            var pageUpdStub = new Stubs.SitePageTweetDateUpdaterStub
            {
                DontThrowNotImpl = true                 //режим работы правильный
            };

            var upd = new LastTweetUpdater(nowDate, animatedTweetDateUpdaterStub, pageUpdStub);

            var page = new db.SitePage
            {
                Title = "https://kawaii-mobile.com/2020/10/uchuu-no-stellvia/",
                URL   = "Uchuu no Stellvia"
            };

            var img = new db.AnimatedImage
            {
                BlobName = "uchuu-no-stellvia",
            };

            TwittData data = new TwittData
            {
                Image = img,
                Page  = page
            };

            upd.UpdateLastTweetDate(data);

            Assert.IsTrue(pageUpdStub.CalledDate == dtNow1);
            Assert.AreSame(pageUpdStub.CalledPage, page);

            Assert.IsTrue(animatedTweetDateUpdaterStub.CalledDate == dtNow1);
            Assert.AreSame(animatedTweetDateUpdaterStub.CalledImage, img);
        }
Ejemplo n.º 3
0
        public void AnimatedTweetDateUpdater_UpdateTweetDateForBlob_Arg_No_Id_Test()
        {
            TestDB testDB             = new TestDB();
            var    animatedCollection = testDB.CreateAnimatedTestDB("animatedtweetdateupdater_test1");
            var    upd = new AnimatedTweetDateUpdater(animatedCollection);

            try
            {
                db.AnimatedImage img = new db.AnimatedImage();
                img.BlobName = "samplepost:img1.gif";

                upd.UpdateTweetDateForBlob(img, new DateTime(2020, 04, 26, 0, 0, 0));
                Assert.Fail("Очікувалося ArgumentException");
            }
            catch (ArgumentException ex)
            {
                Assert.IsTrue(ex.ParamName == "img");
                Assert.IsTrue(ex.Message.Contains("Id"));
            }
        }