public void TestSerializationObserverBuilderWithoutFormula() { ContainerObserverBuilder x1 = CreateObject <ContainerObserverBuilder>().WithName("Oberon.Builder"); x1.MoleculeList.ForAll = true; x1.AddMoleculeName("H2O"); x1.AddMoleculeName("CO2"); x1.AddMoleculeNameToExclude("NO2"); IObserverBuilder x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualObserverBuilder(x2, x1); }
public void TestSerializationObserverBuilderWithConstantFormula() { ContainerObserverBuilder x1 = CreateObject <ContainerObserverBuilder>() .WithName("Obasi.Builder").WithDimension(DimensionLength); x1.MoleculeList.ForAll = false; x1.AddMoleculeName("H2O"); x1.AddMoleculeName("CO2"); x1.Formula = CreateObject <ConstantFormula>().WithDimension(DimensionLength).WithValue(23.4); IObserverBuilder x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualObserverBuilder(x2, x1); }
public void TestSerializationObserverBuilderWithExplicitFormula() { ContainerObserverBuilder x1 = CreateObject <ContainerObserverBuilder>().WithName("Oberon.Builder"); x1.ForAll = false; x1.AddMoleculeName("H2O"); x1.AddMoleculeName("CO2"); ExplicitFormula f1 = CreateObject <ExplicitFormula>().WithName("Fortunato").WithDimension(DimensionLength); IFormulaUsablePath fup = new FormulaUsablePath(new string[] { "aa", "bb" }).WithAlias("b").WithDimension(DimensionLength); f1.AddObjectPath(fup); IFormulaCache formulaCache = new FormulaCache(); formulaCache.Add(f1); x1.Formula = formulaCache[f1.Id]; //SerializeAndDeserializeGeneral(formulaCache); IObserverBuilder x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualObserverBuilder(x2, x1); }