Example #1
0
        public void ValidEmptyConnectionStringCreatesConfiguration()
        {
            var pbxConfig = RegistryConfigurationProvider.BuildConfiguration(_log, "pbx://none");

            Assert.IsFalse(pbxConfig.SerialEnabled);
            Assert.IsFalse(pbxConfig.TCPEnabled);
            Assert.IsNull(pbxConfig.SerialPort);
            Assert.IsNull(pbxConfig.TCPHost);
            Assert.AreEqual(0, pbxConfig.TCPPort);
        }
Example #2
0
        public void ValidTCP_IPv6PBXConnectionStringCreatesConfiguration()
        {
            var pbxConfig = RegistryConfigurationProvider.BuildConfiguration(_log, "pbx://tcp:2001:0db8:85a3:0000:0000:8a2e:0370:7334:8080");

            Assert.IsFalse(pbxConfig.SerialEnabled);
            Assert.IsTrue(pbxConfig.TCPEnabled);
            Assert.IsNull(pbxConfig.SerialPort);
            Assert.AreEqual("2001:0db8:85a3:0000:0000:8a2e:0370:7334", pbxConfig.TCPHost);
            Assert.AreEqual(8080, pbxConfig.TCPPort);
        }
Example #3
0
        public void ValidTCPPBXConnectionStringCreatesConfiguration()
        {
            var pbxConfig = RegistryConfigurationProvider.BuildConfiguration(_log, "pbx://tcp:192.168.1.1:8080");

            Assert.IsFalse(pbxConfig.SerialEnabled);
            Assert.IsTrue(pbxConfig.TCPEnabled);
            Assert.IsNull(pbxConfig.SerialPort);
            Assert.AreEqual("192.168.1.1", pbxConfig.TCPHost);
            Assert.AreEqual(8080, pbxConfig.TCPPort);
        }
Example #4
0
 public void TCPPBXConnectionStringWithInvalidPortThrows()
 {
     Assert.Throws <ArgumentException>(() => RegistryConfigurationProvider.BuildConfiguration(_log, "pbx://tcp:192.168.1.1:80800"));
 }
Example #5
0
 public void PBXConnectionStringWithoutPBXPrefixThrows()
 {
     Assert.Throws <ArgumentException>(() => RegistryConfigurationProvider.BuildConfiguration(_log, "tcp:192.168.1.1:8080"));
 }
Example #6
0
 public void PBXConnectionStringOfShortLengthThrows()
 {
     Assert.Throws <ArgumentException>(() => RegistryConfigurationProvider.BuildConfiguration(_log, "8080"));
 }