public void NotifyDelivery()
        {
            ClickatellNotifier notifier;
            ISmsc smsc;
            ISms sms;
            ISmsStatus status;
            SmsLog smsLog;

            smsc = SmsFactory.GetSmsc();
            sms = Helpers.FillSms();

            // Send the message
            status = smsc.SendImmediate(sms);
            Assert.AreEqual(EnMtStatus.Accepted, status.Status);

            // Verify the message is in the log
            // and the DeliveredOn field is empty
            smsLog = DataHelpers.GetSmsLog(status.ProviderReference);
            Assert.IsNotNull(smsLog);
            Helpers.CompareSms(sms, smsLog);
            Assert.IsNull(smsLog.SmsLogRecipients[0].NotifiedOn);

            // Simulate a notification
            notifier = new ClickatellNotifier();
            notifier.ProcessNotification(DateTime.Now, status.ProviderReference, status.Recipient, (int) NotificationCode.ReceivedByRecipient, null);

            // Verify the DeliveredOn field is not null
            smsLog = DataHelpers.GetSmsLog(status.ProviderReference);
            Assert.IsNotNull(smsLog.SmsLogRecipients[0].NotifiedOn);
        }
        public void NotifyDeliveryError()
        {
            ClickatellNotifier notifier;
            ISmsc smsc;
            ISms sms;
            ISmsStatus status;
            SmsLog smsLog;

            smsc = SmsFactory.GetSmsc();
            sms = Helpers.FillSms();

            // Send the message
            // Send the message
            status = smsc.SendImmediate(sms);
            Assert.AreEqual(EnMtStatus.Accepted, status.Status);

            // Verify the message is in the log
            // and the DeliveredOn field is empty
            smsLog = DataHelpers.GetSmsLog(status.ProviderReference);
            Assert.IsNotNull(smsLog);
            Helpers.CompareSms(sms, smsLog);
            Assert.IsNull(smsLog.SmsLogRecipients[0].NotifiedOn);

            notifier = new ClickatellNotifier();
            notifier.ProcessNotification(DateTime.Now, status.ProviderReference, status.Recipient, - 1, "Sample error code");

            // Verify the error is written into the log
            smsLog = DataHelpers.GetSmsLog(status.ProviderReference);
            Assert.IsNotNull(smsLog.SmsLogRecipients[0].NotifiedOn);
            Assert.AreEqual(-1, smsLog.SmsLogRecipients[0].NotificationCode);
            Assert.AreEqual("Sample error code", smsLog.SmsLogRecipients[0].NotificationMessage);
        }
        public void ProcessRequest(HttpContext context)
        {
            //string apiMsgId, from, charge;
            string cliMsgId, timestamp, to, status;

            //apiMsgId = context.Request["apiMsgId"];
            cliMsgId = context.Request["cliMsgId"];
            timestamp = context.Request["timestamp"];
            to = context.Request["to"];
            //from = context.Request["from"];
            //charge = context.Request["charge"];
            status = context.Request["status"];

            if (!string.IsNullOrEmpty(cliMsgId) && !string.IsNullOrEmpty(timestamp) && !string.IsNullOrEmpty(to) && !string.IsNullOrEmpty(status))
            {
                var statusCode = Convert.ToInt32(status);
                var notifier = new ClickatellNotifier();

                notifier.ProcessNotification(DateTime.Now, cliMsgId, to, statusCode, null);
            }
        }