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);
        }
Пример #2
0
 protected override void Context()
 {
     base.Context();
     _targetProtocol = new SimpleProtocol();
     _targetProtocol.Add(WithExtensions.WithName <IParameter>(DomainHelperForSpecs.ConstantParameterWithValue(1), "SimpleParameter"));
     _sourceProtocol = new AdvancedProtocol {
         Id = "Id", Name = "Advanced Protocol", Description = "tralala"
     };
     _sourceProtocol.Add(WithExtensions.WithName <IParameter>(DomainHelperForSpecs.ConstantParameterWithValue(1), "AdvancedParameter"));
 }
Пример #3
0
 protected override void Context()
 {
     base.Context();
     _sourceProtocol = new SimpleProtocol {
         Id = "Id", Name = "Simple Protocol", Description = "tralala"
     };
     _sourceProtocol.Add(WithExtensions.WithName <IParameter>(DomainHelperForSpecs.ConstantParameterWithValue(1), "SimpleParameter"));
     _targetProtocol = new AdvancedProtocol();
     _targetProtocol.Add(WithExtensions.WithName <IParameter>(DomainHelperForSpecs.ConstantParameterWithValue(1), "AdvancedParameter"));
     _schema1 = new Schema {
         Name = "Schema1"
     };
     _schema2 = new Schema {
         Name = "Schema2"
     };
     _oldSchema = new Schema {
         Name = "_oldSchema"
     };
     _targetProtocol.AddSchema(_oldSchema);
     A.CallTo(() => _schemaMapper.MapFrom(_sourceProtocol)).Returns(new[] { _schema1, _schema2 });
 }