Esempio n. 1
0
        public void Constructor(UInt16 optionIdentifier,
                                Int64 value,
                                NumericScopePropertiesValueTypes numericType,
                                DHCPv6ScopePropertyType valueType)
        {
            var property = new DHCPv6NumericValueScopeProperty(optionIdentifier, value, numericType, valueType);

            Assert.Equal(valueType, property.ValueType);
            Assert.Equal(optionIdentifier, property.OptionIdentifier);
            Assert.Equal(numericType, property.NumericType);
            Assert.Equal(value, property.Value);

            var otherProperty = DHCPv6NumericValueScopeProperty.FromRawValue(optionIdentifier, value.ToString(), numericType);

            Assert.Equal(property, otherProperty);
        }
Esempio n. 2
0
 private DHCPv6ScopePropertyResponse GetScopePropertyResponse(DHCPv6ScopeProperty property)
 {
     return(property switch
     {
         DHCPv6AddressListScopeProperty item => new DHCPv6AddressListScopePropertyResponse
         {
             Addresses = item.Addresses.Select(x => x.ToString()).ToList(),
             OptionCode = item.OptionIdentifier,
             Type = item.ValueType,
         },
         DHCPv6NumericValueScopeProperty item => new DHCPv6NumericScopePropertyResponse
         {
             Value = item.Value,
             NumericType = item.NumericType,
             Type = item.ValueType,
             OptionCode = item.OptionIdentifier,
         },
         _ => throw new NotImplementedException(),
     });