Exemplo n.º 1
0
        public void UpdateSIPDialplanOptionTest()
        {
            SIPEntitiesDomainService target = new SIPEntitiesDomainService(); // TODO: Initialize to an appropriate value
            SIPDialplanOption        currentSIPDialplanOption = null;         // TODO: Initialize to an appropriate value

            target.UpdateSIPDialplanOption(currentSIPDialplanOption);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
        public DialPlanSettings GetSettings(string dialplanName)
        {
            List <SIPDialplanLookup> lookups = GetLookups(dialplanName);
            List <SIPDialplanRoute>  routes  = GetRoutes(dialplanName);
            Dictionary <string, SIPDialplanProvider> providers = GetProviders(dialplanName);
            SIPDialplanOption options = GetOptions(dialplanName);

            return(new DialPlanSettings(lookups, routes, providers, options));
        }
Exemplo n.º 3
0
 public DialPlanSettings(List <SIPDialplanLookup> lookups,
                         List <SIPDialplanRoute> routes,
                         Dictionary <string, SIPDialplanProvider> providers,
                         SIPDialplanOption options)
 {
     Lookups   = lookups;
     Routes    = routes;
     Providers = providers;
     Options   = options;
 }
Exemplo n.º 4
0
 public void UpdateSIPDialplanOption(SIPDialplanOption currentSIPDialplanOption)
 {
     if (currentSIPDialplanOption.Owner != this.ServiceContext.User.Identity.Name)
     {
         throw new ApplicationException("You are not authorised to update this record.");
     }
     else
     {
         this.ObjectContext.SIPDialplanOptions.AttachAsModified(currentSIPDialplanOption, this.ChangeSet.GetOriginal(currentSIPDialplanOption));
     }
 }
        public void ExtractTimezoneOffsetTest()
        {
            SIPDialplanOption options = new SIPDialplanOption()
            {
                Timezone = "(UTC+10:00) Hobart"
            };

            DialPlanSettings settings = new DialPlanSettings(null, null, null, options);

            int timezoneOffset = settings.GetTimezoneOffset();

            Assert.IsTrue(timezoneOffset >= 600 && timezoneOffset <= 660, "The timezone offset extracted was incorrect.");
        }
Exemplo n.º 6
0
        public void InsertSIPDialplanOption(SIPDialplanOption sipDialplanOption)
        {
            sipDialplanOption.Owner = this.ServiceContext.User.Identity.Name;

            if ((sipDialplanOption.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(sipDialplanOption, EntityState.Added);
            }
            else
            {
                this.ObjectContext.SIPDialplanOptions.AddObject(sipDialplanOption);
            }
        }
        public void ExtractENUMServersTest()
        {
            SIPDialplanOption options = new SIPDialplanOption()
            {
                ENUMServers = "e164.org\r\n\r\ne164.info\r\n\r\ne164.arpa\r\n\r\ne164.televolution.net\r\n\r\nenum.org\r\n\r\n"
            };

            DialPlanSettings settings = new DialPlanSettings(null, null, null, options);

            List <string> enumServersList = settings.GetENUMServers();

            Assert.AreEqual(5, enumServersList.Count, "The number of ENUM servers extracted from the list was incorrect.");
            Assert.AreEqual("e164.org", enumServersList[0], "The ENUM server at index 0 was not extracted correctly.");
            Assert.AreEqual("enum.org", enumServersList[4], "The ENUM server at index 4 was not extracted correctly.");
        }
Exemplo n.º 8
0
 public void DeleteSIPDialplanOption(SIPDialplanOption sipDialplanOption)
 {
     if (sipDialplanOption.Owner != this.ServiceContext.User.Identity.Name)
     {
         throw new ApplicationException("You are not authorised to delete this record.");
     }
     else
     {
         if ((sipDialplanOption.EntityState == EntityState.Detached))
         {
             this.ObjectContext.SIPDialplanOptions.Attach(sipDialplanOption);
         }
         this.ObjectContext.SIPDialplanOptions.DeleteObject(sipDialplanOption);
     }
 }
        public void ExtractAllowedCountriesTest()
        {
            SIPDialplanOption options = new SIPDialplanOption()
            {
                AllowedCountryCodes = "1 33 36 37[0-2] 380 39 41 420 44 49 61 7 86 883 886 90 972 998"
            };

            DialPlanSettings settings = new DialPlanSettings(null, null, null, options);

            List <string> allowedCountriesList = settings.GetAllowedCountries();

            Assert.AreEqual(18, allowedCountriesList.Count, "The number of allowed countries extracted from the list was incorrect.");
            Assert.AreEqual("1", allowedCountriesList[0], "The allowed countries at index 0 was not extracted correctly.");
            Assert.AreEqual("37[0-2]", allowedCountriesList[3], "The allowed countries at index 3 was not extracted correctly.");
            Assert.AreEqual("998", allowedCountriesList[17], "The allowed countries at index 7 was not extracted correctly.");
        }
        public void ExtractExcludedPrefixesTest()
        {
            SIPDialplanOption options = new SIPDialplanOption()
            {
                ExcludedPrefixes = " 1 (900 | 809)\r\n\r\n 1 \\d\\d\\d 555 1212\r\n\r\n44 (9 | 55 | 70 | 84 | 87)"
            };

            DialPlanSettings settings = new DialPlanSettings(null, null, null, options);

            List <string> excludedPrefixesList = settings.GetExcludedPrefixes();

            Assert.AreEqual(3, excludedPrefixesList.Count, "The number of excluded prefixes extracted from the list was incorrect.");
            Assert.AreEqual(" 1 (900 | 809)", excludedPrefixesList[0], "The excluded prefixes at index 0 was not extracted correctly.");
            Assert.AreEqual(" 1 \\d\\d\\d 555 1212", excludedPrefixesList[1], "The excluded prefixes at index 1 was not extracted correctly.");
            Assert.AreEqual("44 (9 | 55 | 70 | 84 | 87)", excludedPrefixesList[2], "The excluded prefixes at index 2 was not extracted correctly.");
        }