示例#1
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");
        }
        public async Task StartGetMeReturnsCorrelationIdAsync()
        {
            TelegramModule.Initialize(
                MBTHelper.ConvertMaskedSecretToRealValue(Secrets.TELEGRAM_BOT_API_KEY.ToString()),
                10);
            TelegramModule.SetDebugOutput(true);
            var result          = TelegramModule.StartGetMe();
            var successResponse = JsonConvert.DeserializeObject <Response <string> >(result);

            Assert.True(!string.IsNullOrWhiteSpace(successResponse.CorrelationKey));
            var messageStoreResult = await this.WaitForMessageStoreAsync(successResponse.CorrelationKey);

            Assert.IsType <Response <User> >(JsonConvert.DeserializeObject <Response <User> >(messageStoreResult));
        }