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 TestOfflineHttpRoutingCopyCreateNew()
        {
            RoutingTable routingTable = new RoutingTable(Guid.Empty, new TranslateableLanguageItem("RoutingName"), ChannelType.HTTP);
            IRoutingMatrixCell offlineCell = routingTable.Offline;
            Assert.IsNotNull(offlineCell, "Expected a valid offline routing cell");
            offlineCell.Name.Value = "This is an offline cell";
            offlineCell.Description.Value = "This is a cell that will be used in offline mode";
            Assert.IsNotNull(offlineCell, "Expected a valid offline routing cell");

            RoutingTable copy = routingTable.DeepCopy(false, true) as RoutingTable;
            Assert.AreEqual(offlineCell.Name.Value, copy.Offline.Name.Value);
            Assert.AreNotEqual(offlineCell.Description.Identifier, copy.Offline.Description.Identifier);
            Assert.AreEqual(offlineCell.Description.Value, copy.Offline.Description.Value);
            copy.Offline.Description.Value = "A change was made";
            Assert.AreNotEqual(offlineCell.Description.Value, copy.Offline.Description.Value);

            RoutingTable copy2 = new RoutingTable(routingTable, false, true);
            Assert.AreEqual(offlineCell.Name.Value, copy2.Offline.Name.Value);
            Assert.AreNotEqual(offlineCell.Description.Identifier, copy2.Offline.Description.Identifier);
            Assert.AreEqual(offlineCell.Description.Value, copy2.Offline.Description.Value);
            copy2.Offline.Description.Value = "A change was made";
            Assert.AreNotEqual(offlineCell.Description.Value, copy2.Offline.Description.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);
        }
        public void TestOfflineSmtpRoutingCopyCreateNew()
        {
            RoutingTable routingTable = new RoutingTable(Guid.Empty, new TranslateableLanguageItem("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);

            IRoutingMatrixCell offlineCell = routingTable.Offline;
            Assert.IsNotNull(offlineCell, "Expected a valid offline routing cell");
            offlineCell.Name.Value = "This is an offline cell";
            offlineCell.Description.Value = "This is a cell that will be used in offline mode";
            Assert.IsNotNull(offlineCell, "Expected a valid offline routing cell");

            RoutingTable copy = routingTable.DeepCopy(false, true) as RoutingTable;
            Assert.AreEqual(offlineCell.Name.Value, copy.Offline.Name.Value);
            Assert.AreNotEqual(offlineCell.Description.Identifier, copy.Offline.Description.Identifier);
            Assert.AreEqual(offlineCell.Description.Value, copy.Offline.Description.Value);
            copy.Offline.Description.Value = "A change was made";
            Assert.AreNotEqual(offlineCell.Description.Value, copy.Offline.Description.Value);

            RoutingTable copy2 = new RoutingTable(routingTable, false, true);
            routingTable["resolve"] = new NonTranslateableLanguageItem("emailclient");

            copy2.Destinations.Add(interalGroup);

            Assert.AreEqual(offlineCell.Name.Value, copy2.Offline.Name.Value);
            Assert.AreNotEqual(offlineCell.Description.Identifier, copy2.Offline.Description.Identifier);
            Assert.AreEqual(offlineCell.Description.Value, copy2.Offline.Description.Value);
            copy2.Offline.Description.Value = "A change was made";
            Assert.AreNotEqual(offlineCell.Description.Value, copy2.Offline.Description.Value);
        }
        public void TestDeepCopy()
        {
            RoutingTable routingTable = new RoutingTable(Guid.Empty, new TranslateableLanguageItem("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);

            RoutingItemCollection collection1 = new RoutingItemCollection(Guid.NewGuid(), "Collection1");
            RoutingItemCollection collection2 = new RoutingItemCollection(Guid.NewGuid(), "Collection2");
            RoutingItemCollection collection3 = new RoutingItemCollection(Guid.NewGuid(), "Collection3");
            routingTable.Sources.Add(collection1);
            routingTable.Sources.Add(collection2);
            routingTable.Sources.Add(collection3);

            RoutingItemCollection collection4 = new RoutingItemCollection(Guid.NewGuid(), "Collection4");
            RoutingItemCollection collection5 = new RoutingItemCollection(Guid.NewGuid(), "Collection5");
            RoutingItemCollection collection6 = new RoutingItemCollection(Guid.NewGuid(), "Collection6");
            routingTable.Destinations.Add(collection4);
            routingTable.Destinations.Add(collection5);
            routingTable.Destinations.Add(collection6);

            RoutingTable routingTable2 = routingTable.DeepCopy(true) as RoutingTable;

            Assert.AreEqual(routingTable.Name.Value, routingTable2.Name.Value);
            Assert.AreEqual(routingTable.Sources.Count, routingTable2.Sources.Count);
            Assert.AreEqual(routingTable.Destinations.Count, routingTable2.Destinations.Count);
            Assert.AreEqual(routingTable.CellCount, routingTable2.CellCount);
            Assert.IsTrue(routingTable2.ReadOnly);
        }
        public void TestDeepCopy()
        {
            RoutingTable routingTable = new RoutingTable(Guid.Empty, new TranslateableLanguageItem("RoutingName"), ChannelType.SMTP);

            RoutingItemCollection collection1 = new RoutingItemCollection(Guid.NewGuid(), "Collection1");
            RoutingItemCollection collection2 = new RoutingItemCollection(Guid.NewGuid(), "Collection2");
            RoutingItemCollection collection3 = new RoutingItemCollection(Guid.NewGuid(), "Collection3");
            routingTable.Sources.Add(collection1);
            routingTable.Sources.Add(collection2);
            routingTable.Sources.Add(collection3);

            RoutingItemCollection collection4 = new RoutingItemCollection(Guid.NewGuid(), "Collection4");
            RoutingItemCollection collection5 = new RoutingItemCollection(Guid.NewGuid(), "Collection5");
            RoutingItemCollection collection6 = new RoutingItemCollection(Guid.NewGuid(), "Collection6");
            routingTable.Destinations.Add(collection4);
            routingTable.Destinations.Add(collection5);
            routingTable.Destinations.Add(collection6);

            RoutingTable routingTable2 = routingTable.DeepCopy(true) as RoutingTable;

            Assert.AreEqual(routingTable.Name.Value, routingTable2.Name.Value);
            Assert.AreEqual(routingTable.Sources.Count, routingTable2.Sources.Count);
            Assert.AreEqual(routingTable.Destinations.Count, routingTable2.Destinations.Count);
            Assert.AreEqual(routingTable.CellCount, routingTable2.CellCount);
            Assert.IsTrue(routingTable2.ReadOnly);
        }