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");
		}
        public void Add(ChannelProtectionRequirements protectionRequirements, bool channelScopeOnly)
        {
            if (protectionRequirements == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("protectionRequirements"));
            }

            if (protectionRequirements._incomingSignatureParts != null)
            {
                _incomingSignatureParts.AddParts(protectionRequirements._incomingSignatureParts.ChannelParts);
            }
            if (protectionRequirements._incomingEncryptionParts != null)
            {
                _incomingEncryptionParts.AddParts(protectionRequirements._incomingEncryptionParts.ChannelParts);
            }
            if (protectionRequirements._outgoingSignatureParts != null)
            {
                _outgoingSignatureParts.AddParts(protectionRequirements._outgoingSignatureParts.ChannelParts);
            }
            if (protectionRequirements._outgoingEncryptionParts != null)
            {
                _outgoingEncryptionParts.AddParts(protectionRequirements._outgoingEncryptionParts.ChannelParts);
            }

            if (!channelScopeOnly)
            {
                AddActionParts(_incomingSignatureParts, protectionRequirements._incomingSignatureParts);
                AddActionParts(_incomingEncryptionParts, protectionRequirements._incomingEncryptionParts);
                AddActionParts(_outgoingSignatureParts, protectionRequirements._outgoingSignatureParts);
                AddActionParts(_outgoingEncryptionParts, protectionRequirements._outgoingEncryptionParts);
            }
        }
 private static void AddActionParts(ScopedMessagePartSpecification to, ScopedMessagePartSpecification from)
 {
     foreach (string action in from.Actions)
     {
         MessagePartSpecification p;
         if (from.TryGetParts(action, true, out p))
         {
             to.AddParts(p, action);
         }
     }
 }
예제 #4
0
 private static void AddActionParts(ScopedMessagePartSpecification to, ScopedMessagePartSpecification from)
 {
     foreach (string str in from.Actions)
     {
         MessagePartSpecification specification;
         if (from.TryGetParts(str, true, out specification))
         {
             to.AddParts(specification, str);
         }
     }
 }
예제 #5
0
        void AddScopedParts(ScopedMessagePartSpecification src, ScopedMessagePartSpecification dst, bool channelOnly)
        {
            dst.AddParts(src.ChannelParts);
            if (channelOnly)
            {
                return;
            }

            foreach (string a in src.Actions)
            {
                MessagePartSpecification m;
                src.TryGetParts(a, out m);
                src.AddParts(m);
            }
        }
 internal void CopyTo(ScopedMessagePartSpecification target)
 {
     if (target == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(target));
     }
     target.ChannelParts.IsBodyIncluded = ChannelParts.IsBodyIncluded;
     foreach (XmlQualifiedName headerType in ChannelParts.HeaderTypes)
     {
         if (!target.ChannelParts.IsHeaderIncluded(headerType.Name, headerType.Namespace))
         {
             target.ChannelParts.HeaderTypes.Add(headerType);
         }
     }
     foreach (string action in _actionParts.Keys)
     {
         target.AddParts(_actionParts[action], action);
     }
 }
예제 #7
0
 internal void CopyTo(ScopedMessagePartSpecification target)
 {
     if (target == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("target");
     }
     target.ChannelParts.IsBodyIncluded = this.ChannelParts.IsBodyIncluded;
     foreach (XmlQualifiedName name in this.ChannelParts.HeaderTypes)
     {
         if (!target.channelParts.IsHeaderIncluded(name.Name, name.Namespace))
         {
             target.ChannelParts.HeaderTypes.Add(name);
         }
     }
     foreach (string str in this.actionParts.Keys)
     {
         target.AddParts(this.actionParts[str], str);
     }
 }
 private static void AddActionParts(ScopedMessagePartSpecification to, ScopedMessagePartSpecification from)
 {
     foreach (string action in from.Actions)
     {
         MessagePartSpecification p;
         if (from.TryGetParts(action, true, out p))
             to.AddParts(p, action);
     }
 }
 internal void CopyTo(ScopedMessagePartSpecification target)
 {
     if (target == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("target");
     }
     target.ChannelParts.IsBodyIncluded = this.ChannelParts.IsBodyIncluded;
     foreach (XmlQualifiedName headerType in ChannelParts.HeaderTypes)
     {
         if (!target._channelParts.IsHeaderIncluded(headerType.Name, headerType.Namespace))
         {
             target.ChannelParts.HeaderTypes.Add(headerType);
         }
     }
     foreach (string action in _actionParts.Keys)
     {
         target.AddParts(_actionParts[action], action);
     }
 }
예제 #10
0
		void AddScopedParts (ScopedMessagePartSpecification src, ScopedMessagePartSpecification dst, bool channelOnly)
		{
			dst.AddParts (src.ChannelParts);
			if (channelOnly)
				return;

			foreach (string a in src.Actions) {
				MessagePartSpecification m;
				src.TryGetParts (a, out m);
				src.AddParts (m);
			}
		}
		public void AddPartsNull3 ()
		{
			ScopedMessagePartSpecification s =
				new ScopedMessagePartSpecification ();
			s.AddParts (new MessagePartSpecification (), null);
		}
		public void AddPartsNull2 ()
		{
			ScopedMessagePartSpecification s =
				new ScopedMessagePartSpecification ();
			s.AddParts (null, "urn:foo");
		}
		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));
		}
		public void AddToReadOnlyCollection ()
		{
			ScopedMessagePartSpecification s =
				new ScopedMessagePartSpecification ();
			s.MakeReadOnly ();
			Assert.AreEqual (true, s.IsReadOnly, "#1");
			s.AddParts (new MessagePartSpecification (), "urn:myaction");
		}
 private static void AddActionParts(ScopedMessagePartSpecification to, ScopedMessagePartSpecification from)
 {
     foreach (string str in from.Actions)
     {
         MessagePartSpecification specification;
         if (from.TryGetParts(str, true, out specification))
         {
             to.AddParts(specification, str);
         }
     }
 }