public void InstatiatesWithDefaultValueIfNonDefined() { var definition = new ValueReferenceDefinitionBuilder().Build(); var instantiated = definition.CreateValueReference(engine); Assert.AreEqual(BigDouble.Zero, instantiated.ValueAsNumber()); Assert.AreEqual(false, instantiated.ValueAsBool()); Assert.AreEqual(null, instantiated.ValueAsMap()); Assert.AreEqual("0", instantiated.ValueAsString()); }
public void CanDefineAnUpdaterAction() { var definition = new ValueReferenceDefinitionBuilder() .WithUpdater((engine, parent, deltaTime, previousValue) => { return((BigDouble)previousValue + BigDouble.One); }) .Build(); var instantiated = definition.CreateValueReference(engine); Assert.AreEqual(BigDouble.Zero, instantiated.ValueAsNumber()); instantiated.Update(engine, 1f); Assert.AreEqual(BigDouble.One, instantiated.ValueAsNumber()); }