Ejemplo n.º 1
0
        private string GetSetObjectPropertyResponse(string address)
        {
            var queries = UrlHelpers.CrackUrl(address);

            PropertyInfo info;

            if (typeof(TObjectProperty) == typeof(ObjectProperty))
            {
                info = BaseSetObjectPropertyParameters <TObjectProperty> .GetPropertyInfoViaTypeLookup((Enum)(object)property);
            }
            else if (typeof(TObjectProperty) == typeof(ChannelProperty))
            {
                info = BaseSetObjectPropertyParameters <TObjectProperty> .GetPropertyInfoViaPropertyParameter <Channel>((Enum)(object)property);
            }
            else
            {
                throw new NotImplementedException($"Handler for object property type {nameof(TObjectProperty)} is not implemented");
            }

            var queryName = BaseSetObjectPropertyParameters <TObjectProperty> .GetParameterNameStatic((Enum)(object)property, info);

            if (typeof(TObjectProperty) == typeof(ChannelProperty))
            {
                queryName += "1"; //Channel ID used for tests
            }
            var val = queries[queryName];

            Assert.IsTrue(val == expectedValue, $"The value of property '{property.ToString().ToLower()}' did not match the expected value. Expected '{expectedValue}', received: '{val}'");

            return("OK");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieves an object that defines the dynamic parameters of this cmdlet.
        /// </summary>
        /// <returns>An object that defines the dynamic parameters of this cmdlet.</returns>
        public object GetDynamicParameters()
        {
            if (dynamicParams == null)
            {
                dynamicParams = new DynamicParameterSet <ObjectProperty>(
                    ParameterSet.Dynamic,
                    e => BaseSetObjectPropertyParameters <ObjectProperty> .GetPropertyInfoViaTypeLookup(e).Property
                    );
            }

            return(dynamicParams.Parameters);
        }
Ejemplo n.º 3
0
        private void ParseValue()
        {
            var prop = BaseSetObjectPropertyParameters <ObjectProperty> .GetPropertyInfoViaTypeLookup(Property);

            Value = ParseValueIfRequired(prop, Value);
        }