Пример #1
0
        public async Task SendSmsWithoutParametersShouldThrowException()
        {
            ISmsNotification emptySmsNotification = null;
            var source = new Mock <ISmsSender>();
            TwilioSmsConfiguration emptyConfig = new TwilioSmsConfiguration();
            var mockSmsService = new SmsNotificationService(source.Object);

            await Assert.ThrowsAsync <ArgumentNullException>(() => mockSmsService.SendAsync(emptySmsNotification));
        }
Пример #2
0
        public async Task GetStatusTest()
        {
            var service = new SmsNotificationService
            {
                Authentication = _textFixture.Authentication,
                Username       = _textFixture.MainApiUsername,
                Password       = _textFixture.MainApiPassword,
                SenderId       = _textFixture.MainApiSenderId
            };

            await service.GetStatus("ENTER-MESSAGE-ID-HERE");
        }
Пример #3
0
        public async Task SendMessageTest()
        {
            var service = new SmsNotificationService
            {
                Authentication = _textFixture.Authentication,
                Username       = _textFixture.MainApiUsername,
                Password       = _textFixture.MainApiPassword,
                SenderId       = _textFixture.MainApiSenderId
            };

            await service.SendMessage("ENTER-NUMBER-HERE", "ENTER-MESSAGE-CONTENT-HERE");
        }
Пример #4
0
        private static async Task RunExample()
        {
            ISmsNotificationService service = new SmsNotificationService
            {
                Authentication = new KeyAuthentication(Environment.GetEnvironmentVariable("APIKEY"))
            };

            var result = await service.SendMessage("082298968201", "Halo test BigBoxNet.");

            Console.WriteLine("Code: {0}", result.Code);
            Console.WriteLine("Message ID: {0}", result.MessageId);
            Console.WriteLine("Message: {0}", result.Message);
            Console.WriteLine("Status: {0}", result.Status);
        }
Пример #5
0
        public async Task SendSmsNotification()
        {
            var smsSender  = new TwilioSmsSender(_smsConfiguration.Configuration, _smsConfiguration.TwilioRestClient);
            var smsService = new SmsNotificationService(smsSender);
            var recipients = new List <string>()
            {
                _smsConfiguration.RecipientPhoneNumber
            };
            var sms = new BaseSmsNotification()
            {
                Text = SmsText, RecipientPhoneNumbers = recipients
            };

            await smsService.SendAsync(sms);
        }
Пример #6
0
 public ReviewsController(IReviewDao reviewDao, EmailNotificationService emailService, SmsNotificationService smsService)
 {
     _dao = reviewDao;
     _emailNotificationService = emailService;
     _smsNotificationService   = smsService;
 }