Example #1
0
        private static void ValidateParamValue <TValue, TType, TParamValue>(TType type, TValue value, Action <string> output = null)
            where TType : Pv2ParamType <TValue, TParamValue>, new()
            where TParamValue : Pv2ParamValue, new()
        {
            var config = new InMemoryConfiguration();
            var val    = type.CreateValue();

            val.Index = (uint)new Random().Next(0, 999);
            var realValue = value;

            type.SetValue(val, realValue);
            type.ValidateValue(val);
            var toString = $"{value, 5} => {type.ConvertToString(val)}";

            type.WriteToConfig(config, "TEST", val);
            Assert.Equal(realValue, type.GetValue(type.ReadFromConfig(config, "TEST")));
            Assert.Equal(realValue, type.GetValue(val));
            SpanTestHelper.TestType((TParamValue)val, output, toString);
        }
Example #2
0
 private static void ValidateParamType <TValue, TType, TParamValue>(TType type, Action <string> output = null)
     where TType : Pv2ParamType <TValue, TParamValue>, new() where TParamValue : Pv2ParamValue
 {
     type.ValidateSize();
     SpanTestHelper.TestType(type, output);
 }