Пример #1
0
        public void GetUpdatesReturnsNullOrMoreMessages()
        {
            TelegramModule.Initialize(
                MBTHelper.ConvertMaskedSecretToRealValue(Secrets.TELEGRAM_BOT_API_KEY.ToString()),
                10);
            TelegramModule.SetDebugOutput(true);
            var result          = TelegramModule.GetUpdates(0, 0);
            var successResponse = JsonConvert.DeserializeObject <Response <Update[]> >(result);

            Assert.True(successResponse.IsSuccess);
        }
Пример #2
0
        public void GetUpdatesSucceeds()
        {
            var mock = new Mock <ITelegramBotMapper>();

            mock.Setup(x => x.GetUpdates(0, 0)).Returns("ok");
            mock.Setup(x => x.StartGetUpdates(0, 0)).Returns("ok");

            TelegramModule.Initialize(ApiKey, 10);
            TelegramModule.Bot = mock.Object;

            Assert.True(TelegramModule.GetUpdates(0, 0) == "ok");
            Assert.True(TelegramModule.StartGetUpdates(0, 0) == "ok");
        }