public void SendDocumentInputsGetValidated() { var mock = new Mock <ITelegramBotMapper>(); TelegramModule.Initialize(ApiKey, 10); TelegramModule.Bot = mock.Object; Assert.Contains(nameof(ArgumentException), TelegramModule.SendDocument(string.Empty, "D:/PathToFile.png")); Assert.Contains(nameof(ArgumentException), TelegramModule.SendDocument("-102264846545", string.Empty)); Assert.Contains(nameof(ArgumentException), TelegramModule.StartSendDocument(string.Empty, "D:/PathToFile.png")); Assert.Contains(nameof(ArgumentException), TelegramModule.StartSendDocument("-102264846545", string.Empty)); }
public void SendDocumentSendsDocumentMessageToUser() { TelegramModule.Initialize( MBTHelper.ConvertMaskedSecretToRealValue(Secrets.TELEGRAM_BOT_API_KEY.ToString()), 10); TelegramModule.SetDebugOutput(true); var result = TelegramModule.SendDocument( MBTHelper.ConvertMaskedSecretToRealValue(Secrets.TELEGRAM_USER_ID.ToString()), $"assets/fake_log.txt"); var successResponse = JsonConvert.DeserializeObject <Response <Message> >(result); Assert.NotEmpty(successResponse.Content.Document.FileId); }
public void SendDocumentSucceeds() { var mock = new Mock <ITelegramBotMapper>(); mock.Setup(x => x.SendDocument(It.IsAny <string>(), It.IsAny <string>())).Returns("ok"); mock.Setup(x => x.StartSendDocument(It.IsAny <string>(), It.IsAny <string>())).Returns("ok"); TelegramModule.Initialize(ApiKey, 10); TelegramModule.Bot = mock.Object; Assert.True(TelegramModule.SendDocument("some text", "assets/fake_log.txt") == "ok"); Assert.True(TelegramModule.StartSendDocument("some text", "assets/fake_log.txt") == "ok"); }