示例#1
0
        private string GetSetObjectPropertyResponse(string address)
        {
            var queries = UrlUtilities.CrackUrl(address);

            PropertyCache cache;

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

            var queryName = ObjectPropertyParser.GetObjectPropertyNameViaCache((Enum)(object)property, cache);

            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");
        }
示例#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 <ChannelProperty>(
                    new[] { ParameterSet.Dynamic, ParameterSet.DynamicManual },
                    e => ObjectPropertyParser.GetPropertyInfoViaPropertyParameter <Channel>(e).Property
                    );
            }

            return(dynamicParams.Parameters);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SetChannelProperty"/> class.
 /// </summary>
 public SetChannelProperty()
 {
     implementation = new InternalSetSubObjectPropertyCmdlet <Channel, ChannelParameter, ChannelProperty>(
         this,
         "Sensor",
         "Channel",
         (p, v) => new ChannelParameter(p, v),
         (c, p) => client.SetChannelProperty(c, p),
         (c, p) => client.SetChannelProperty(c, p),
         (o, s, p) => client.SetChannelProperty(o, s, p),
         e => ObjectPropertyParser.GetPropertyInfoViaPropertyParameter <Channel>(e).Property.PropertyType
         );
 }
示例#4
0
 public override PropertyCache GetPropertyCache(Enum property)
 {
     return(ObjectPropertyParser.GetPropertyInfoViaPropertyParameter <Channel>(property));
 }