예제 #1
0
    public static void MessageHeader_MustUnderStand_Sets(bool mustUnderstand)
    {
        MessageHeaderAttribute attribute = new MessageHeaderAttribute();

        attribute.MustUnderstand = mustUnderstand;
        Assert.Equal(mustUnderstand, attribute.MustUnderstand);
    }
예제 #2
0
        private static MessageHeaderAttribute ConvertFromServiceModelMessageHeadertAttribute(object attr)
        {
            Fx.Assert(attr.GetType().FullName.Equals(ServiceReflector.SMMessageHeaderAttributeFullName), "Expected attribute of type System.ServiceModel.MessageHeader");

            bool hasProtectionLevel = GetProperty <bool>(attr, "HasProtectionLevel");

            if (hasProtectionLevel)
            {
                // ProtectionLevel isn't supported yet so if it was set on the S.SM.SCA, then we can't do the mapping so throw
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new PlatformNotSupportedException("System.ServiceModel.ServiceContractAttribute.ProtectionLevel"));
            }

            var messageHeader = new MessageHeaderAttribute();

            string tmpStr = GetProperty <string>(attr, nameof(MessageHeaderAttribute.Actor));

            if (!string.IsNullOrEmpty(tmpStr))
            {
                messageHeader.Actor = tmpStr;
            }
            tmpStr = GetProperty <string>(attr, nameof(MessageHeaderAttribute.Name));
            if (!string.IsNullOrEmpty(tmpStr))
            {
                messageHeader.Name = tmpStr;
            }
            tmpStr = GetProperty <string>(attr, nameof(MessageHeaderAttribute.Namespace));
            if (!string.IsNullOrEmpty(tmpStr))
            {
                messageHeader.Namespace = tmpStr;
            }
            messageHeader.MustUnderstand = GetProperty <bool>(attr, nameof(MessageHeaderAttribute.MustUnderstand));
            messageHeader.Relay          = GetProperty <bool>(attr, nameof(MessageHeaderAttribute.Relay));
            return(messageHeader);
        }
예제 #3
0
//		public static void FillMessageBodyDescriptionByContract (
//			Type messageType, MessageBodyDescription mb)
//		{
//		}

        static MessageHeaderDescription CreateHeaderDescription(MessageHeaderAttribute mha, string defaultName, string defaultNamespace)
        {
            var ret = CreatePartCore <MessageHeaderDescription> (mha, defaultName, defaultNamespace, delegate(string n, string ns) { return(new MessageHeaderDescription(n, ns)); });

            ret.Actor          = mha.Actor;
            ret.MustUnderstand = mha.MustUnderstand;
            ret.Relay          = mha.Relay;
            return(ret);
        }