Exemplo n.º 1
0
        public void MissingInitializationLeedsToErrors()
        {
            var exportResponse = TelegramModule.GetMe();
            var responseError  = JsonConvert.DeserializeObject <Response <Error> >(exportResponse);

            Assert.Equal(typeof(ApplicationException).Name, responseError.Content.ExceptionType);
        }
Exemplo n.º 2
0
        public void GetMeReturnsBotUser()
        {
            TelegramModule.Initialize(
                MBTHelper.ConvertMaskedSecretToRealValue(Secrets.TELEGRAM_BOT_API_KEY.ToString()),
                10);
            TelegramModule.SetDebugOutput(true);
            var result          = TelegramModule.GetMe();
            var successResponse = JsonConvert.DeserializeObject <Response <User> >(result);

            Assert.True(successResponse.Content.IsBot);
        }
Exemplo n.º 3
0
        public void GetMeSucceeds()
        {
            var mock = new Mock <ITelegramBotMapper>();

            mock.Setup(x => x.GetMe()).Returns("ok");
            mock.Setup(x => x.StartGetMe()).Returns("ok");

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

            Assert.True(TelegramModule.GetMe() == "ok");
            Assert.True(TelegramModule.StartGetMe() == "ok");
        }