public void UnTypedValueInsideRange() { var modifyPatchType = new ModifyPropertyValuePatchType(); var template = "IntProperty:+2(10-20)"; var parsed = modifyPatchType.ValueParser.Parse(template); Assert.NotNull(parsed); Assert.Equal("IntProperty", parsed.ValueType); Assert.NotNull(parsed.ValueRange); Assert.Equal(new Range(10, 20), parsed.ValueRange); var iProp = new IntPropertyData { Value = 10 }; var result = modifyPatchType.RunPatch(new[] { iProp }, template); Assert.Equal(12, iProp.Value); }
public void TypedValueOutsideRange() { var modifyPatchType = new ModifyPropertyValuePatchType(); var template = "FloatProperty:+12.5(0-10)"; var parsed = modifyPatchType.ValueParser.Parse(template); Assert.NotNull(parsed); Assert.Equal("FloatProperty", parsed.ValueType); Assert.NotNull(parsed.ValueRange); Assert.Equal(new Range(0, 10), parsed.ValueRange); var fProp = new FloatPropertyData() { Value = (float)16 }; var result = modifyPatchType.RunPatch(new[] { fProp }, template); Assert.Equal(10, fProp.Value); }