public void AddParts() { ScopedMessagePartSpecification s = new ScopedMessagePartSpecification(); Assert.IsFalse(s.ChannelParts.IsBodyIncluded, "#1"); s.AddParts(new MessagePartSpecification(true)); Assert.AreEqual(0, s.Actions.Count, "#2"); Assert.IsTrue(s.ChannelParts.IsBodyIncluded, "#3"); XmlQualifiedName foo = new XmlQualifiedName("foo"); XmlQualifiedName bar = new XmlQualifiedName("bar"); s.AddParts(new MessagePartSpecification(new XmlQualifiedName [] { foo }), "urn:foo"); Assert.AreEqual(1, s.Actions.Count, "#4"); MessagePartSpecification m; s.TryGetParts("urn:foo", out m); Assert.IsNotNull(m, "#5"); Assert.AreEqual(1, m.HeaderTypes.Count, "#6"); s.AddParts(new MessagePartSpecification(true, new XmlQualifiedName [] { bar }), "urn:foo"); Assert.AreEqual(1, s.Actions.Count, "#7"); s.TryGetParts("urn:foo", out m); Assert.IsNotNull(m, "#8"); //List<XmlQualifiedName> l = new List<XmlQualifiedName> (m.HeaderTypes); Assert.AreEqual(2, m.HeaderTypes.Count, "#9"); Assert.IsTrue(m.IsBodyIncluded, "#10"); }
private void ApplySigningRequirements(ScopedMessagePartSpecification spec) { MessagePartSpecification parts = new MessagePartSpecification(new XmlQualifiedName[] { new XmlQualifiedName("PeerVia", "http://schemas.microsoft.com/net/2006/05/peer"), new XmlQualifiedName("FloodMessage", "http://schemas.microsoft.com/net/2006/05/peer"), new XmlQualifiedName("PeerTo", "http://schemas.microsoft.com/net/2006/05/peer"), new XmlQualifiedName("MessageID", "http://schemas.microsoft.com/net/2006/05/peer") }); foreach (string str in spec.Actions) { spec.AddParts(parts, str); } spec.AddParts(parts, "*"); }
void ApplySigningRequirements(ScopedMessagePartSpecification spec) { //following are the headers that we add and want signed. MessagePartSpecification partSpec = new MessagePartSpecification( new XmlQualifiedName(PeerStrings.Via, PeerStrings.Namespace), new XmlQualifiedName(PeerOperationNames.Flood, PeerStrings.Namespace), new XmlQualifiedName(PeerOperationNames.PeerTo, PeerStrings.Namespace), new XmlQualifiedName(PeerStrings.MessageId, PeerStrings.Namespace)); foreach (string action in spec.Actions) { spec.AddParts(partSpec, action); } spec.AddParts(partSpec, MessageHeaders.WildcardAction); }
public void AddPartsNull3() { ScopedMessagePartSpecification s = new ScopedMessagePartSpecification(); s.AddParts(new MessagePartSpecification(), null); }
public void AddPartsNull2() { ScopedMessagePartSpecification s = new ScopedMessagePartSpecification(); s.AddParts(null, "urn:foo"); }
static void ProtectProtocolMessage( ScopedMessagePartSpecification signaturePart, ScopedMessagePartSpecification encryptionPart, string action) { signaturePart.AddParts(BodyOnly, action); encryptionPart.AddParts(MessagePartSpecification.NoParts, action); }
public void AddToReadOnlyCollection() { ScopedMessagePartSpecification s = new ScopedMessagePartSpecification(); s.MakeReadOnly(); Assert.AreEqual(true, s.IsReadOnly, "#1"); s.AddParts(new MessagePartSpecification(), "urn:myaction"); }
public void TryGetParts() { ScopedMessagePartSpecification s = new ScopedMessagePartSpecification(); MessagePartSpecification ret; Assert.IsFalse(s.TryGetParts("urn:myaction", out ret)); Assert.IsFalse(s.TryGetParts("urn:myaction", true, out ret)); Assert.IsFalse(s.TryGetParts("urn:myaction", false, out ret)); s.AddParts(new MessagePartSpecification(), "urn:myaction"); Assert.IsTrue(s.TryGetParts("urn:myaction", out ret)); Assert.IsTrue(s.TryGetParts("urn:myaction", true, out ret)); Assert.IsTrue(s.TryGetParts("urn:myaction", false, out ret)); }