Пример #1
0
        public void TestAssignSmtpRoutingTableToActiveContentChannel()
        {
            Guid channelId = new Guid("{E403E7C2-6654-4E0A-90F2-DBC5C22517CA}");
            IPolicyLanguageItem channelName = new TranslateableLanguageItem("Test channel");
            PolicyChannel policyChannel = new PolicyChannel(channelId, channelName, ChannelType.ActiveContent);

            policyChannel.Routing = new RoutingTable(Guid.Empty, new TranslateableLanguageItem("RoutingName"), ChannelType.SMTP);
        }
Пример #2
0
 public void TestCreateActiveContentRoutingTable()
 {
     Guid id = new Guid("{0621E3A5-C236-4E9D-84FB-E81119D73A13}");
     IPolicyLanguageItem routingName = new TranslateableLanguageItem("Active content routing table");
     IRoutingTable routingTable = RoutingTableFactory.Instance.Create(ChannelType.ActiveContent, id, routingName, false);
     Assert.IsNotNull(routingTable);
     Assert.AreEqual(routingName.Value, routingTable.Name.Value);
     Assert.AreEqual(ChannelType.ActiveContent, routingTable.Type);
 }
Пример #3
0
 public void TestCreateSmtpRoutingTable()
 {
     Guid id = new Guid("{DCFC6999-5A1C-43A3-8216-4B700EDFDD33}");
     IPolicyLanguageItem routingName = new TranslateableLanguageItem("SMTP routing table");
     IRoutingTable routingTable = RoutingTableFactory.Instance.Create(ChannelType.SMTP, id, routingName, false);
     Assert.IsNotNull(routingTable);
     Assert.AreEqual(ChannelType.SMTP, routingTable.Type);
     Assert.AreEqual(routingName.Value, routingTable.Name.Value);
 }
        public void TestClone()
        {
            TranslateableLanguageItem item = new TranslateableLanguageItem(Guid.NewGuid(), "Item Name");

            IPolicyLanguageItem copy = item.Clone();
            Assert.IsNotNull(copy);
            Assert.AreNotEqual(item.Identifier, copy.Identifier);
            Assert.AreEqual(item.Value, copy.Value);
        }
Пример #5
0
        public void TestCreateSmtpRoutingTableAssignToPolicyChannel()
        { 
            Guid id = new Guid("{DCFC6999-5A1C-43A3-8216-4B700EDFDD33}");
            IPolicyLanguageItem name = new TranslateableLanguageItem("SMTP channel");
            PolicyChannel policyChannel = new PolicyChannel(id, name, ChannelType.SMTP);
            Assert.AreEqual(name.Value, policyChannel.Name.Value);

            Guid routingId = new Guid("{DCFC6999-5A1C-43A3-8216-4B700EDFDD33}");
            IPolicyLanguageItem routingName = new TranslateableLanguageItem("SMTP routing table");
            policyChannel.Routing = RoutingTableFactory.Instance.Create(ChannelType.SMTP, routingId, routingName, false);
            IRoutingTable routingTable = policyChannel.Routing;
            Assert.IsNotNull(routingTable);
            Assert.AreEqual(ChannelType.SMTP, routingTable.Type);
            Assert.AreEqual(routingName.Value, routingTable.Name.Value);
        }
Пример #6
0
        public void TestDeepCopy()
        {
            Guid id = new Guid("{53BC19DB-1D34-4995-82FE-8041C9E71EC5}");
            IPolicyLanguageItem name = new TranslateableLanguageItem("Test routing");
            RoutingTable httpRoutingTable = new RoutingTable(id, name, ChannelType.HTTP);
            Assert.AreEqual(id, httpRoutingTable.Identifier);
            Assert.IsFalse(httpRoutingTable.ReadOnly);
            Assert.IsNotNull(httpRoutingTable.Name);
            Assert.IsNotInstanceOf(typeof(NonTranslateableLanguageItem), httpRoutingTable.Name.GetType());
            Assert.AreEqual(name.Value, httpRoutingTable.Name.Value);
            Assert.IsNotNull(httpRoutingTable.DefaultDestination);
            Assert.IsNotNull(httpRoutingTable.DefaultSource);
            Assert.IsNotNull(httpRoutingTable[httpRoutingTable.DefaultSource, httpRoutingTable.DefaultDestination]);
            httpRoutingTable[httpRoutingTable.DefaultSource, httpRoutingTable.DefaultDestination].Name.Value = "This is the routing cell";

            RoutingTable copy = httpRoutingTable.DeepCopy(true, false) as RoutingTable;
            Assert.IsNotNull(copy);
            Assert.AreEqual(id, copy.Identifier);
            Assert.IsTrue(copy.ReadOnly);
            Assert.IsNotNull(copy.Name);
            Assert.IsNotInstanceOf(typeof(TranslateableLanguageItem), copy.Name.GetType());
            Assert.AreEqual(name.Identifier, copy.Name.Identifier);
            Assert.AreEqual(name.Value, copy.Name.Value);
            Assert.IsNotNull(copy[copy.DefaultSource, copy.DefaultDestination]);
            Assert.IsNotNull(copy[copy.DefaultSource, copy.DefaultDestination].Name);
            Assert.IsNotInstanceOf(typeof(NonTranslateableLanguageItem), copy[copy.DefaultSource, copy.DefaultDestination].Name.GetType());
            Assert.AreEqual(httpRoutingTable[httpRoutingTable.DefaultSource, httpRoutingTable.DefaultDestination].Identifier, copy[copy.DefaultSource, copy.DefaultDestination].Identifier);
            Assert.AreEqual(httpRoutingTable[httpRoutingTable.DefaultSource, httpRoutingTable.DefaultDestination].Name.Identifier, copy[copy.DefaultSource, copy.DefaultDestination].Name.Identifier);
            Assert.AreEqual(httpRoutingTable[httpRoutingTable.DefaultSource, httpRoutingTable.DefaultDestination].Name.Value, copy[copy.DefaultSource, copy.DefaultDestination].Name.Value);
        }
        public void TestDeepCopyNew()
        {
            Guid id = new Guid("{53BC19DB-1D34-4995-82FE-8041C9E71EC5}");
            IPolicyLanguageItem name = new TranslateableLanguageItem("Test routing");
            RoutingTable activeContentRoutingTable = new RoutingTable(id, name, ChannelType.ActiveContent);
            Assert.AreEqual(id, activeContentRoutingTable.Identifier);
            Assert.IsFalse(activeContentRoutingTable.ReadOnly);
            Assert.IsNotNull(activeContentRoutingTable.Name);
            Assert.IsNotInstanceOf(typeof(NonTranslateableLanguageItem), activeContentRoutingTable.Name.GetType());
            Assert.AreEqual(name.Value, activeContentRoutingTable.Name.Value);
            Assert.IsNotNull(activeContentRoutingTable.DefaultDestination);
            Assert.IsNotNull(activeContentRoutingTable.DefaultSource);
            Assert.IsNotNull(activeContentRoutingTable[activeContentRoutingTable.DefaultSource, activeContentRoutingTable.DefaultDestination]);
            Assert.IsNotNull(activeContentRoutingTable[activeContentRoutingTable.DefaultSource, activeContentRoutingTable.DefaultDestination].Name);
            activeContentRoutingTable[activeContentRoutingTable.DefaultSource, activeContentRoutingTable.DefaultDestination].Name = new TranslateableLanguageItem("This is the routing cell");

            RoutingTable copy = activeContentRoutingTable.DeepCopy(false, true) as RoutingTable;
            Assert.IsNotNull(copy);
            Assert.AreNotEqual(id, copy.Identifier);
            Assert.IsFalse(copy.ReadOnly);
            Assert.IsNotNull(copy.Name);
            Assert.IsNotInstanceOf(typeof(TranslateableLanguageItem), copy.Name.GetType());
            Assert.AreNotEqual(name.Identifier, copy.Name.Identifier);
            Assert.AreEqual(name.Value, copy.Name.Value);
            Assert.IsNotNull(copy.DefaultSource);
            Assert.IsNotNull(copy.DefaultDestination);
            Assert.IsNotNull(copy[copy.DefaultSource, copy.DefaultDestination]);
            Assert.IsNotNull(copy[copy.DefaultSource, copy.DefaultDestination].Name);
            Assert.IsNotInstanceOf(typeof(NonTranslateableLanguageItem), copy[copy.DefaultSource, copy.DefaultDestination].Name.GetType());
            Assert.AreEqual(activeContentRoutingTable[activeContentRoutingTable.DefaultSource, activeContentRoutingTable.DefaultDestination].Identifier, copy[copy.DefaultSource, copy.DefaultDestination].Identifier);
            Assert.AreNotEqual(activeContentRoutingTable[activeContentRoutingTable.DefaultSource, activeContentRoutingTable.DefaultDestination].Name.Identifier, copy[copy.DefaultSource, copy.DefaultDestination].Name.Identifier);
            Assert.AreEqual(activeContentRoutingTable[activeContentRoutingTable.DefaultSource, activeContentRoutingTable.DefaultDestination].Name.Value, copy[copy.DefaultSource, copy.DefaultDestination].Name.Value);
        }
Пример #8
0
        public void TestCopyInternalExternalSmtpRoutingTable()
        {
            Guid id = new Guid("{DCFC6999-5A1C-43A3-8216-4B700EDFDD33}");
            IPolicyLanguageItem routingName = new TranslateableLanguageItem("Internal External SMTP routing table");
            IRoutingTable routingTable = new RoutingTable(id, routingName, ChannelType.SMTP);
            routingTable["resolve"] = new NonTranslateableLanguageItem("emailclient");

            RoutingItemCollection interalGroup = new RoutingItemCollection(Guid.NewGuid(), "Recipients:Internal");
            interalGroup.Add(new RoutingItem("Recipients:Internal", "Recipients:Internal"));
            interalGroup["InternalGroup"] = new NonTranslateableLanguageItem("true");
            interalGroup["assembly"] = new NonTranslateableLanguageItem("Workshare.InternalExternalResolver.dll");
            interalGroup["class"] = new NonTranslateableLanguageItem("Workshare.InternalExternalResolver");
            routingTable.Destinations.Add(interalGroup);

            Assert.IsNotNull(routingTable);
            Assert.AreEqual(ChannelType.SMTP, routingTable.Type);
            Assert.AreEqual(routingName.Value, routingTable.Name.Value);

            IRoutingTable routingTableCopy = RoutingTableFactory.Instance.Copy(routingTable, false, true);
            Assert.IsNotNull(routingTableCopy);
            Assert.AreEqual(routingName.Value, routingTableCopy.Name.Value);
            Assert.AreEqual(ChannelType.SMTP, routingTableCopy.Type);
            Assert.AreNotEqual(routingTable.Identifier, routingTableCopy.Identifier);
        }
Пример #9
0
        public void TestCopyHttpRoutingTable()
        {
            Guid id = new Guid("{0621E3A5-C236-4E9D-84FB-E81119D73A13}");
            IPolicyLanguageItem routingName = new TranslateableLanguageItem("HTTP routing table");
            IRoutingTable routingTable = RoutingTableFactory.Instance.Create(ChannelType.HTTP, id, routingName, false);
            Assert.IsNotNull(routingTable);
            Assert.AreEqual(ChannelType.HTTP, routingTable.Type);
            Assert.AreEqual(routingName.Value, routingTable.Name.Value);

            IRoutingTable routingTableCopy = RoutingTableFactory.Instance.Copy(routingTable, false, true);
            Assert.IsNotNull(routingTableCopy);
            Assert.AreEqual(routingName.Value, routingTableCopy.Name.Value);
            Assert.AreEqual(ChannelType.HTTP, routingTableCopy.Type);
            Assert.AreNotEqual(routingTable.Identifier, routingTableCopy.Identifier);
        }