예제 #1
0
        public void AddSmsDevice_InvalidEventTriggerType_Failure()
        {
            var res = NotificationDevice.AddSmsDevice(_connectionServer, "objectid", "devicename", "providerID", "*****@*****.**",
                                                      "*****@*****.**", "bogusevent", true);

            Assert.IsFalse(res.Success, "Calling AddSmsDevice with invalid event type trigger did not fail");
        }
        public void AddSmsDevice_EmptySender_Failure()
        {
            var res = NotificationDevice.AddSmsDevice(_mockServer, "objectid", "SMSDevice", "aaa", "*****@*****.**", "",
                                                      NotificationEventTypes.NewVoiceMail.ToString(), true);

            Assert.IsFalse(res.Success, "Empty sender parameter should fail");
        }
예제 #3
0
        public void AddPagerDevice_InvalidEventTriggerType_Failure()
        {
            var res = NotificationDevice.AddPagerDevice(_connectionServer, "objectid", "devicename", "mediaswitchid", "234234",
                                                        "bogusevent", true);

            Assert.IsFalse(res.Success, "Calling AddPagerDevice with invalid eventID did not fail");
        }
        public void UpdateNotificationDevice_EmptyPropertyList_Failure()
        {
            var res = NotificationDevice.UpdateNotificationDevice(_mockServer, "objectid", "aaa",
                                                                  NotificationDeviceTypes.Pager, null);

            Assert.IsFalse(res.Success, "Empty prop list should fail");
        }
        public void AddPagerDevice_EmptyPhoneNumber_Failure()
        {
            var res = NotificationDevice.AddPagerDevice(_mockServer, "objectid", "devicename", "mediaswitchid", "",
                                                        "event", true);

            Assert.IsFalse(res.Success, "Calling AddPagerDevice with empty phone number did not fail");
        }
예제 #6
0
        public void DeleteNotificationDevice_InvalidObjectId_Failure()
        {
            var res = NotificationDevice.DeleteNotificationDevice(_connectionServer, _tempUser.ObjectId, "aaa",
                                                                  NotificationDeviceTypes.Sms);

            Assert.IsFalse(res.Success, "Invalid device objectID should fail");
        }
예제 #7
0
        public void NotificationDevice_AddPhoneDevice()
        {
            var res = NotificationDevice.AddPhoneDevice(_connectionServer, _tempUser.ObjectId, Guid.NewGuid().ToString(),
                                                        _tempUser.MediaSwitchObjectId, "234234", "NewUrgentVoiceMail", false);

            Assert.IsTrue(res.Success, "Failed to create new phone notification device");
        }
        public void AddPagerDevice_NullConnectionServer_Failure()
        {
            var res = NotificationDevice.AddPagerDevice(null, "objectid", "devicename", "mediaswitchid", "234234",
                                                        "event", true);

            Assert.IsFalse(res.Success, "Calling AddPagerDevice with null Connection server did not fail");
        }
        public void AddPagerDevice_EmptyMediaSwitchId_Failure()
        {
            var res = NotificationDevice.AddPagerDevice(_mockServer, "objectid", "devicename", "", "234234",
                                                        "event", true);

            Assert.IsFalse(res.Success, "Calling AddPagerDevice with empty mediaswitchid did not fail");
        }
예제 #10
0
        public void AddPhoneDevice_InvalidEventTrigger_Failure()
        {
            var res = NotificationDevice.AddPhoneDevice(_mockServer, "objectid", "devicename", "mediaswitchid", "234234",
                                                        "invalidevent", true);

            Assert.IsFalse(res.Success, "Calling AddPhoneDevice with invalid media even type trigger did not fail");
        }
예제 #11
0
        public void AddSmsDevice_EmptySenderAddress_Failure()
        {
            var res = NotificationDevice.AddSmsDevice(_mockServer, "objectid", "devicename", "providerID", "*****@*****.**",
                                                      "", "eventtype", true);

            Assert.IsFalse(res.Success, "Calling AddSmsDevice with empty senderaddress did not fail");
        }
예제 #12
0
        public async Task <bool> AddDeviceAsync(NotificationDevice device, CancellationToken cancel)
        {
            if (device == null)
            {
                return(false);
            }

            var devices = await GetDevicesAsync(cancel);

            await _Sync.WaitAsync(cancel);

            try{
                var match = devices.FirstOrDefault(d => d.Id == device.Id);
                if (match == null)
                {
                    devices.Add(device);
                }
                else if (match.AreSame(device))
                {
                    return(false);
                }
                else
                {
                    devices[devices.IndexOf(match)] = device;
                }

                await SaveDevicesAsync();

                return(true);
            }finally{
                _Sync.Release();
            }
        }
예제 #13
0
        public void AddHtmlDevice_InvalidEventTriggerType_Failure()
        {
            var res = NotificationDevice.AddHtmlDevice(_connectionServer, "objectid", "templateid", "device name", "*****@*****.**",
                                                       "bogusevent", false);

            Assert.IsFalse(res.Success, "Calling AddHtmlDevice with bogus device trigger type did not fail");
        }
예제 #14
0
        public void NotificationDevice_AddSmtpDevice()
        {
            var res = NotificationDevice.AddSmtpDevice(_connectionServer, _tempUser.ObjectId, Guid.NewGuid().ToString(),
                                                       "*****@*****.**", "AllMessage", true);

            Assert.IsTrue(res.Success, "Failed to create new SMTP device:" + res);
        }
예제 #15
0
        public void GetNotificationDevices_EmptyUserObjectId_Failure()
        {
            List <NotificationDevice> oDevices;

            var res = NotificationDevice.GetNotificationDevices(_mockServer, "", out oDevices);

            Assert.IsFalse(res.Success, "Empty UserObjectID should fail.");
        }
예제 #16
0
 public Task <bool> AddDeviceAsync(
     NotificationDevice device,
     [FromQuery] string clientToken,
     CancellationToken cancel)
 {
     _Config.VerifyClientToken(clientToken);
     return(_Mgr.AddDeviceAsync(device, cancel));
 }
예제 #17
0
 public bool AreSame(NotificationDevice device)
 {
     if (device == null)
     {
         return(false);
     }
     return(Id == device.Id && Type == device.Type);
 }
예제 #18
0
        public void GetNotificationDevice_InvalidObjectId_Failure()
        {
            NotificationDevice oDevice;

            var res = NotificationDevice.GetNotificationDevice(_connectionServer, _tempUser.ObjectId, "aaa", "", out oDevice);

            Assert.IsFalse(res.Success, "Invalid objectID should fail");
        }
예제 #19
0
        public void AddSmsDevice_InvalidSmppProvider_Failure()
        {
            var res = NotificationDevice.AddSmsDevice(_connectionServer, _tempUser.ObjectId, "SMSDevice", "aaa",
                                                      "*****@*****.**", "*****@*****.**",
                                                      NotificationEventTypes.NewVoiceMail.ToString(), true);

            Assert.IsFalse(res.Success, "Invalid SMPP provider Id should fail");
        }
예제 #20
0
        public void GetNotificationDevices_NullConnectionServer_Failure()
        {
            List <NotificationDevice> oDevices;

            //get Notification Device list failure points.
            WebCallResult res = NotificationDevice.GetNotificationDevices(null, "objectid", out oDevices);

            Assert.IsFalse(res.Success, "Null Connection server object should fail");
        }
예제 #21
0
        public void GetNotificationDevices_Success()
        {
            List <NotificationDevice> oDevices;

            //get the notificaiton devices for the operator
            WebCallResult res = NotificationDevice.GetNotificationDevices(_connectionServer, _tempUser.ObjectId, out oDevices);

            Assert.IsTrue(res.Success, "Failed to fetch notification devices for operator:" + res);
        }
예제 #22
0
        public void AddSmsDevice_NullConnectionServer_Failure()
        {
            //since we can't add an SMS device without a provider (which we can't dummy up) just hit the failure routes here and call
            //it good.
            WebCallResult res = NotificationDevice.AddSmsDevice(null, "objectid", "SMSDevice", "aaa", "*****@*****.**", "*****@*****.**",
                                                                NotificationEventTypes.NewVoiceMail.ToString(), true);

            Assert.IsFalse(res.Success, "Null Connection server param should fail");
        }
예제 #23
0
        public void NotificationDevice_Test()
        {
            _errorString = "";
            List <NotificationDevice> oNotificationDevices;
            var res = NotificationDevice.GetNotificationDevices(_connectionServer, _tempUser.ObjectId, out oNotificationDevices);

            Assert.IsTrue(res.Success, "Failed to fetch notificationdevice:" + res);
            Assert.IsTrue(string.IsNullOrEmpty(_errorString), _errorString);
        }
예제 #24
0
        public void UpdateNotificationDevice_NullConnectionServer_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("item", "value");

            WebCallResult res = NotificationDevice.UpdateNotificationDevice(null, "objectid", "aaa", NotificationDeviceTypes.Pager, oProps);

            Assert.IsFalse(res.Success, "Null Connection Server object should fail");
        }
예제 #25
0
        public void GetNotificationDevices_InvalidObjectId_Success()
        {
            List <NotificationDevice> oDevices;

            var res = NotificationDevice.GetNotificationDevices(_connectionServer, "aaa", out oDevices);

            Assert.IsTrue(res.Success, "Fetching notification devices with invalid name should not fail.");
            Assert.IsFalse(oDevices == null, "Invalid UserObjectID fetch returned null devices list.");
            Assert.IsTrue(oDevices.Count == 0, "Invalid UserObjectID fetch returned one or more devices.");
        }
예제 #26
0
        public void UpdateNotificationDevice_EmptyDeviceObjectId_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("item", "value");

            var res = NotificationDevice.UpdateNotificationDevice(_mockServer, "objectid", "", NotificationDeviceTypes.Pager, oProps);

            Assert.IsFalse(res.Success, "Empty device objectID should fail");
        }
예제 #27
0
        public void UpdateNotificationDevice_InvalidObjectId_Failure()
        {
            //failure paths for update calls
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("item", "value");

            var res = NotificationDevice.UpdateNotificationDevice(_connectionServer, _tempUser.ObjectId, "aaa",
                                                                  NotificationDeviceTypes.Pager, oProps);

            Assert.IsFalse(res.Success, "Invalid device objectId should fail");
        }
예제 #28
0
        public void GetNotificationDevice_Success()
        {
            NotificationDevice        oDevice;
            List <NotificationDevice> oDevices;

            WebCallResult res = NotificationDevice.GetNotificationDevices(_connectionServer, _tempUser.ObjectId, out oDevices);

            Assert.IsTrue(res.Success, "Failed to fetch notification devices for operator:" + res);

            //fetch the single device returned as the first in the list from the last test
            res = NotificationDevice.GetNotificationDevice(_connectionServer, _tempUser.ObjectId, oDevices.First().ObjectId, "", out oDevice);
            Assert.IsTrue(res.Success, "Failed to fetch notification device for operator:" + res);
        }
예제 #29
0
        public void NotificationDevice_AddSmsDevice()
        {
            List <SmppProvider> oProviders;
            var res = SmppProvider.GetSmppProviders(_connectionServer, out oProviders);

            Assert.IsTrue(res.Success, "Failed fetching SMPP providers:" + res);
            Assert.IsTrue(oProviders.Count > 0, "No SMPP providers found");

            res = NotificationDevice.AddSmsDevice(_connectionServer, _tempUser.ObjectId, Guid.NewGuid().ToString(),
                                                  oProviders[0].ObjectId, "*****@*****.**", "*****@*****.**",
                                                  "DispatchMessage", true);

            Assert.IsTrue(res.Success, "Failed to create new SMS notification device:" + res);
        }
예제 #30
0
        public void NotificationDevice_FetchTests()
        {
            List <NotificationDevice> oDevices = _tempUser.NotificationDevices(true);

            Assert.IsNotNull(oDevices, "Failted to get devices from user");
            Assert.IsNotNull(oDevices, "Null device list returned from user");
            Assert.IsTrue(oDevices.Count > 0, "No devices returned from user");
            Console.WriteLine(oDevices[0].ToString());
            Console.WriteLine(oDevices[0].DumpAllProps());

            NotificationDevice oDevice;
            var res = NotificationDevice.GetNotificationDevice(_connectionServer, _tempUser.ObjectId, "", oDevices[0].DisplayName, out oDevice);

            Assert.IsTrue(res.Success, "Failed to fetch notificaiton device by name:" + res);
        }