void ValidateWnsHeaders()

in src/Microsoft.Azure.NotificationHubs/WindowsTemplateRegistrationDescription.cs [321:343]


        void ValidateWnsHeaders()
        {
            if (this.WnsHeaders == null)
            {
                throw new InvalidDataContractException(string.Format(SRClient.MissingWNSHeader, WindowsTemplateRegistrationDescription.Type));
            }

            if (!this.WnsHeaders.ContainsKey(WindowsTemplateRegistrationDescription.Type) || string.IsNullOrWhiteSpace(this.WnsHeaders[WindowsTemplateRegistrationDescription.Type]))
            {
                throw new InvalidDataContractException(string.Format(SRClient.MissingWNSHeader, WindowsTemplateRegistrationDescription.Type));
            }

            // WNS headers validation
            foreach (string header in this.WnsHeaders.Keys)
            {
                if (string.IsNullOrWhiteSpace(this.WnsHeaders[header]))
                {
                    throw new InvalidDataContractException(string.Format(SRClient.WNSHeaderNullOrEmpty, header));
                }

                ExpressionEvaluator.Validate(this.WnsHeaders[header]);
            }
        }