public void TestSerializationQuantityWithExplicitFormula() { Observer x1 = CreateObject <Observer>().WithName("Quentin").WithDimension(DimensionLength); x1.ParentContainer = C1; x1.IsFixedValue = false; x1.Persistable = false; x1.Formula = CreateObject <ConstantFormula>().WithDimension(DimensionLength).WithValue(23.4); ExplicitFormula f1 = CreateObject <ExplicitFormula>().WithName("Fortunato").WithDimension(DimensionLength); f1.AddObjectPath(ObjectPathFactory.CreateAbsoluteFormulaUsablePath(P1)); f1.AddObjectPath(ObjectPathFactory.CreateRelativeFormulaUsablePath(P, P0)); f1.AddObjectPath(ObjectPathFactory.CreateRelativeFormulaUsablePath(P, P2).WithAlias("Pitter")); f1.ResolveObjectPathsFor(P); f1.FormulaString = "Paul + Peter + Pitter"; P1.Value = 1.0; P0.Value = 10.0; P2.Value = 2.0; x1.Formula = f1; IQuantity x2 = SerializeAndDeserialize(x1); x2.ParentContainer = C1; x2.Formula.ResolveObjectPathsFor(x2); AssertForSpecs.AreEqualQuantity(x2, x1); }
public void TestSerializationEmptyQuantity() { Observer x1 = CreateObject <Observer>(); x1.NegativeValuesAllowed = true; IQuantity x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualQuantity(x2, x1); }
public void TestSerializationQuantityWithConstantFormula() { Observer x1 = CreateObject <Observer>().WithName("Quentin").WithDimension(DimensionLength); x1.IsFixedValue = false; x1.Persistable = false; x1.Formula = CreateObject <ConstantFormula>().WithDimension(DimensionLength).WithValue(23.4); var x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualQuantity(x2, x1); }
public void TestSerializationQuantityWithFixedValue() { Observer x1 = CreateObject <Observer>().WithName("Quentin").WithDimension(DimensionLength); x1.Persistable = true; x1.NegativeValuesAllowed = false; x1.IsFixedValue = true; x1.Value = 2.3; var x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualQuantity(x2, x1); }
public void TestSerialization() { var x1 = new QuantityPKParameter { Name = "C_max", Dimension = DimensionMassConcentration, QuantityPath = "A|B|C" }; x1.SetValue(1, 5.0f); x1.SetValue(2, 4.0f); x1.SetValue(8, 2.0f); var x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualQuantity(x2, x1); }