Exemple #1
0
        public void GetPostAsync_One_Line_Text_Test()
        {
            var webChannelTools = new WebChannelTools();

            var tsk = webChannelTools.GetPostAsync("telegram", 3);

            tsk.Wait();
            var actual = tsk.Result;

            Assert.IsNotNull(actual);
            Assert.AreEqual(string.Empty, actual.Author);
            Assert.AreEqual("This thing is about to become the official Telegram channel on Telegram.", actual.Body);
            Assert.AreEqual(TelegramPostType.Text, actual.PostType);
            Assert.IsNull(actual.AttachmentUri);
            Assert.AreEqual(DateTime.Parse("2015-09-21T02:15:20+00:00", Thread.CurrentThread.CurrentCulture), actual.Date);
            Assert.AreEqual("Sep 21, 2015 at 02:15", actual.DateString);
            Assert.AreEqual(3, actual.Id);
            Assert.AreEqual("This thing is about to become the official Telegram channel on Telegram.", actual.PossibleTitle);
            Assert.AreEqual("This thing is about to become the official Telegram channel on Telegram.", actual.TextRaw);
            Assert.IsFalse(string.IsNullOrWhiteSpace(actual.ViewCount));
            Assert.IsFalse(string.IsNullOrWhiteSpace(actual.WebRaw));
        }
Exemple #2
0
        public void GetPostAsync_Sticker_Test()
        {
            var webChannelTools = new WebChannelTools();

            var tsk = webChannelTools.GetPostAsync("telegram", 4);

            tsk.Wait();
            var actual = tsk.Result;

            Assert.IsNotNull(actual);
            Assert.AreEqual(string.Empty, actual.Author);
            Assert.AreEqual("", actual.Body);
            Assert.AreEqual(TelegramPostType.Sticker, actual.PostType);
            Assert.IsNotNull(actual.AttachmentUri);
            Assert.AreEqual(DateTime.Parse("2015-09-21T02:17:40+00:00", Thread.CurrentThread.CurrentCulture), actual.Date);
            Assert.AreEqual("Sep 21, 2015 at 02:17", actual.DateString);
            Assert.AreEqual(4, actual.Id);
            Assert.AreEqual("", actual.PossibleTitle);
            Assert.AreEqual("", actual.TextRaw);
            Assert.IsFalse(string.IsNullOrWhiteSpace(actual.ViewCount));
            Assert.IsFalse(string.IsNullOrWhiteSpace(actual.WebRaw));
        }