예제 #1
0
        public void TestSerialization()
        {
            TransportBuilder x1 = CreateObject <TransportBuilder>().WithName("Priscilla.Builder").WithDimension(DimensionLength);

            x1.Formula = CreateObject <ConstantFormula>().WithDimension(DimensionLength).WithValue(23.4);
            x1.CreateProcessRateParameter = true;
            IFormula           f1  = CreateObject <ExplicitFormula>().WithDimension(DimensionLength).WithFormulaString("3*Patty");
            IFormulaUsablePath fup = new FormulaUsablePath(new[] { "Patricia" }).WithAlias("Patty").WithDimension(DimensionLength);

            f1.AddObjectPath(fup);
            //WithValue to avoid formula evaluation in McAssertForSpecs-comparison.
            IParameter p1 = CreateObject <Parameter>().WithName("Patricia").WithFormula(f1).WithValue(3.1);
            IParameter p2 = CreateObject <Parameter>().WithName("Pascal").WithFormula(f1).WithValue(3.2);

            x1.AddParameter(p1);
            x1.AddParameter(p2);

            ITransportBuilder x2 = SerializeAndDeserialize(x1);

            AssertForSpecs.AreEqualProcessBuilder(x1, x2);
        }