public void TestRemoveRoutingMatrixRecipients() { 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 senders1 = new RoutingItemCollection(Guid.NewGuid(), "Collection1"); RoutingItemCollection senders2 = new RoutingItemCollection(Guid.NewGuid(), "Collection2"); routingTable.Sources.Add(senders1); routingTable.Sources.Add(senders2); RoutingItemCollection recipients1 = new RoutingItemCollection(Guid.NewGuid(), "Collection3"); RoutingItemCollection recipients2 = new RoutingItemCollection(Guid.NewGuid(), "Collection4"); routingTable.Destinations.Add(recipients1); routingTable.Destinations.Add(recipients2); Assert.AreEqual(6, routingTable.CellCount); Assert.IsFalse(routingTable.HasCell(recipients2, recipients1)); Assert.IsFalse(routingTable.HasCell(senders1, senders2)); Assert.IsTrue(routingTable.HasCell(senders1, recipients1)); Assert.IsTrue(routingTable.HasCell(senders1, recipients2)); Assert.IsTrue(routingTable.HasCell(senders2, recipients1)); Assert.IsTrue(routingTable.HasCell(senders2, recipients2)); //TODO: uncomment when precedence is implemented - RJ //Assert.AreEqual(1, routingTable[senders1, recipients1].Precedence); //Assert.AreEqual(2,routingTable[senders1, recipients2].Precedence); //Assert.AreEqual(3, routingTable[senders2, recipients1].Precedence); //Assert.AreEqual(4, routingTable[senders2, recipients2].Precedence); routingTable.Destinations.Remove(recipients1); Assert.AreEqual(4, routingTable.CellCount); Assert.IsFalse(routingTable.HasCell(recipients2, recipients1)); Assert.IsFalse(routingTable.HasCell(senders1, senders2)); Assert.IsFalse(routingTable.HasCell(senders1, recipients1)); Assert.IsTrue(routingTable.HasCell(senders1, recipients2)); Assert.IsFalse(routingTable.HasCell(senders2, recipients1)); Assert.IsTrue(routingTable.HasCell(senders2, recipients2)); //TODO: uncomment when precedence is implemented - RJ //Assert.AreEqual(1, routingTable[senders1, recipients2].Precedence); //Assert.AreEqual(2, routingTable[senders2, recipients2].Precedence); }
public void TestRemoveRoutingMatrixRecipients() { RoutingTable routingTable = new RoutingTable(Guid.Empty, new TranslateableLanguageItem("RoutingName"), ChannelType.SMTP); RoutingItemCollection senders1 = new RoutingItemCollection(Guid.NewGuid(), "Collection1"); RoutingItemCollection senders2 = new RoutingItemCollection(Guid.NewGuid(), "Collection2"); routingTable.Sources.Add(senders1); routingTable.Sources.Add(senders2); RoutingItemCollection recipients1 = new RoutingItemCollection(Guid.NewGuid(), "Collection3"); RoutingItemCollection recipients2 = new RoutingItemCollection(Guid.NewGuid(), "Collection4"); routingTable.Destinations.Add(recipients1); routingTable.Destinations.Add(recipients2); Assert.AreEqual(4, routingTable.CellCount); Assert.IsFalse(routingTable.HasCell(recipients2, recipients1)); Assert.IsFalse(routingTable.HasCell(senders1, senders2)); Assert.IsTrue(routingTable.HasCell(senders1, recipients1)); Assert.IsTrue(routingTable.HasCell(senders1, recipients2)); Assert.IsTrue(routingTable.HasCell(senders2, recipients1)); Assert.IsTrue(routingTable.HasCell(senders2, recipients2)); //TODO: uncomment when precedence is implemented - RJ //Assert.AreEqual(1, routingTable[senders1, recipients1].Precedence); //Assert.AreEqual(2,routingTable[senders1, recipients2].Precedence); //Assert.AreEqual(3, routingTable[senders2, recipients1].Precedence); //Assert.AreEqual(4, routingTable[senders2, recipients2].Precedence); routingTable.Destinations.Remove(recipients1); Assert.AreEqual(2, routingTable.CellCount); Assert.IsFalse(routingTable.HasCell(recipients2, recipients1)); Assert.IsFalse(routingTable.HasCell(senders1, senders2)); Assert.IsFalse(routingTable.HasCell(senders1, recipients1)); Assert.IsTrue(routingTable.HasCell(senders1, recipients2)); Assert.IsFalse(routingTable.HasCell(senders2, recipients1)); Assert.IsTrue(routingTable.HasCell(senders2, recipients2)); //TODO: uncomment when precedence is implemented - RJ //Assert.AreEqual(1, routingTable[senders1, recipients2].Precedence); //Assert.AreEqual(2, routingTable[senders2, recipients2].Precedence); }
public void TestHasCell() { 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); IRoutingItemCollection defaultSenders = routingTable.DefaultSource; IRoutingItemCollection defautRecipients = routingTable.DefaultDestination; IRoutingItemCollection internalRecipients = routingTable.Destinations[0]; Assert.AreEqual(2, routingTable.CellCount); Assert.IsFalse(routingTable.HasCell(defautRecipients, internalRecipients)); Assert.IsTrue(routingTable.HasCell(defaultSenders, defautRecipients)); Assert.IsTrue(routingTable.HasCell(defaultSenders, internalRecipients)); }
public void TestHasCell() { 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"); routingTable.Sources.Add(collection1); routingTable.Sources.Add(collection2); RoutingItemCollection collection3 = new RoutingItemCollection(Guid.NewGuid(), "Collection3"); RoutingItemCollection collection4 = new RoutingItemCollection(Guid.NewGuid(), "Collection4"); routingTable.Destinations.Add(collection3); routingTable.Destinations.Add(collection4); Assert.AreEqual(4, routingTable.CellCount); Assert.IsFalse(routingTable.HasCell(collection4, collection3)); Assert.IsFalse(routingTable.HasCell(collection1, collection2)); Assert.IsTrue(routingTable.HasCell(collection1, collection3)); Assert.IsTrue(routingTable.HasCell(collection1, collection4)); Assert.IsTrue(routingTable.HasCell(collection2, collection3)); Assert.IsTrue(routingTable.HasCell(collection2, collection4)); }