public void TestSerialization() { EventBuilder x1 = CreateObject <EventBuilder>().WithName("Eve.Builder").WithDimension(DimensionLength); x1.Formula = CreateObject <ConstantFormula>().WithDimension(DimensionLength).WithValue(23.4); x1.OneTime = true; IFormula f1 = CreateObject <ExplicitFormula>().WithDimension(DimensionLength).WithFormulaString("3*Patty"); IFormulaUsablePath fup = new FormulaUsablePath(new string[] { "Patricia" }).WithAlias("Patty").WithDimension(DimensionLength); f1.AddObjectPath(fup); IFormula f2 = CreateObject <ConstantFormula>().WithDimension(DimensionLength).WithValue(23.4); IParameter p1 = WithExtensions.WithValue <Parameter>(CreateObject <Parameter>().WithName("Patricia").WithFormula(f1), 3.1); IParameter p2 = WithExtensions.WithValue <Parameter>(CreateObject <Parameter>().WithName("Pascal").WithFormula(f1), 3.2); x1.AddParameter(p1); x1.AddParameter(p2); IEventAssignmentBuilder eab1 = CreateObject <EventAssignmentBuilder>().WithDimension(DimensionLength).WithFormula(f1).WithName("eab1"); IEventAssignmentBuilder eab2 = CreateObject <EventAssignmentBuilder>().WithFormula(f2).WithName("eab2"); x1.AddAssignment(eab1); x1.AddAssignment(eab2); var x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualEventBuilder(x1, x2); }
protected override void Context() { base.Context(); var e1 = new EventBuilder().WithName("Event"); e1.OneTime = true; var eventAssignmentBuilder1 = new EventAssignmentBuilder(); eventAssignmentBuilder1.ObjectPath = new ObjectPath("Sim|A|B|C"); eventAssignmentBuilder1.Name = "EAB"; eventAssignmentBuilder1.Formula = new ExplicitFormula("a+b"); e1.AddAssignment(eventAssignmentBuilder1); e1.AddParameter(new Parameter().WithName("P1")); var e2 = new EventBuilder().WithName("Event"); e2.OneTime = true; var eventAssignmentBuilder2 = new EventAssignmentBuilder(); eventAssignmentBuilder2.ObjectPath = new ObjectPath("Sim|A|B|C"); eventAssignmentBuilder2.Name = "EAB"; eventAssignmentBuilder2.Formula = new ExplicitFormula("a+b"); e2.AddAssignment(eventAssignmentBuilder2); _object1 = e1; _object2 = e2; }