コード例 #1
0
        public void Validate()
        {
            if (CallbackUrl.IsSpecified)
            {
                Preconditions.NotEmpty(CallbackUrl.ToString(), nameof(CallbackUrl));
            }
            if (Topic.IsSpecified)
            {
                Preconditions.NotEmpty(Topic.ToString(), nameof(Topic));
            }
            if (Secret.IsSpecified)
            {
                Preconditions.NotEmpty(Secret.ToString(), nameof(Secret));
            }
            if (!Mode.IsSpecified)
            {
                throw new ArgumentException(nameof(Mode));
            }

            if (LeaseSeconds.IsSpecified)
            {
                Preconditions.GreaterThan(LeaseSeconds, 0, nameof(LeaseSeconds));
                Preconditions.LessThan(LeaseSeconds, 864000, nameof(LeaseSeconds));
            }
        }
コード例 #2
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (CallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("CallbackUrl", CallbackUrl.ToString()));
            }

            if (TriggerValue != null)
            {
                p.Add(new KeyValuePair <string, string>("TriggerValue", TriggerValue));
            }

            if (UsageCategory != null)
            {
                p.Add(new KeyValuePair <string, string>("UsageCategory", UsageCategory.ToString()));
            }

            if (CallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("CallbackMethod", CallbackMethod.ToString()));
            }

            if (FriendlyName != null)
            {
                p.Add(new KeyValuePair <string, string>("FriendlyName", FriendlyName));
            }

            if (Recurring != null)
            {
                p.Add(new KeyValuePair <string, string>("Recurring", Recurring.ToString()));
            }

            if (TriggerBy != null)
            {
                p.Add(new KeyValuePair <string, string>("TriggerBy", TriggerBy.ToString()));
            }

            return(p);
        }
コード例 #3
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (CallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("CallbackMethod", CallbackMethod.ToString()));
            }

            if (CallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("CallbackUrl", CallbackUrl.ToString()));
            }

            if (FriendlyName != null)
            {
                p.Add(new KeyValuePair <string, string>("FriendlyName", FriendlyName));
            }

            return(p);
        }
コード例 #4
0
        public void ToString_Value_Must_Be_Equal_With_Url()
        {
            var instance = new CallbackUrl(ExpectedUrl);

            Assert.AreEqual(ExpectedUrl, instance.ToString());
        }