コード例 #1
0
        public void Composer_SingleValue_OK()
        {
            // value in object
            SingleValue value1 = new SingleValue();
            value1.Name = "val 1";
            value1.Value = "0022";
            value1.Length = 2;

            SingleValue value2 = new SingleValue();
            value2.Name = "val 2";
            value2.Value = string.Empty;
            value2.Length = 2;

            // value definition in XML
            XElement definition = new XElement("Definition");
            definition.Add(XElementHelper.generateFromSingleValue(value1));
            definition.Add(XElementHelper.generateFromSingleValue(value2));

            Composer composer = new Composer();
            composer.ParseValueDefinition(definition);

            Assert.AreEqual(2, composer.Vals.Count);
            AreEqualSingleValue(value1, (SingleValue)composer.Vals[0]);
            AreEqualSingleValue(value2, (SingleValue)composer.Vals[1]);
        }
コード例 #2
0
        public void Composer_TLValue_OK()
        {
            // value in object
            TLValue value1 = new TLValue();
            value1.Name = "val 1";
            value1.Value = "0022";
            value1.Length = 2;
            value1.Tag = "04";

            TLValue value2 = new TLValue();
            value2.Name = "val 2";
            value2.Value = string.Empty;
            value2.Length = 2;
            value2.Tag = "09";

            // value definition in XML
            XElement definition = new XElement("Head");
            definition.Add(XElementHelper.generateFromTLValue(value1));
            definition.Add(XElementHelper.generateFromTLValue(value2));

            // exercise the composer
            Composer composer = new Composer();
            composer.ParseValueDefinition(definition);

            // check the result
            Assert.AreEqual(2, composer.Vals.Count);
            AreEqualTLValue(value1, (TLValue)composer.Vals[0]);
            AreEqualTLValue(value2, (TLValue)composer.Vals[1]);
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: rrajaguk/QOEParser
 public Form1()
 {
     InitializeComponent();
     composer = new Composer();
 }
コード例 #4
0
        public void Composer_ValueDefinition_OK()
        {
            TLValue bareValue1 = new TLValue();
            bareValue1.Name = "val 1";
            bareValue1.Value = "0022";
            bareValue1.Length = 2;
            bareValue1.Tag = "04";

            ValueDescriptionDecorator value1= new ValueDescriptionDecorator(bareValue1);
            value1.ArrayOfOptions.Add(1, createOptions(3, 1, 1));
            value1.ArrayOfOptions.Add(2, createOptions(10, 2, 1));

            //value definition in XML
            XElement definition = new XElement("Definition");
            definition.Add(XElementHelper.generateFromValueDescriptionDecorator(value1));

            Composer composer = new Composer();
            composer.ParseValueDefinition(definition);

            // check the result
            Assert.AreEqual(1, composer.Vals.Count);
            Assert.IsInstanceOfType(composer.Vals[0], typeof(ValueDescriptionDecorator));
            AreEqualValueDescriptionDecorator(value1, (ValueDescriptionDecorator)composer.Vals[0]);
        }
コード例 #5
0
ファイル: ValueResultTest.cs プロジェクト: rrajaguk/QOEParser
        public void valInit()
        {
            // value in object
            value_basicTLV_1 = new TLValue();
            value_basicTLV_1.Name = "val 1";
            value_basicTLV_1.Value = "0022";
            value_basicTLV_1.Length = 2;
            value_basicTLV_1.Tag = "04";

            value_basicTLV_2 = new TLValue();
            value_basicTLV_2.Name = "val 2";
            value_basicTLV_2.Value = string.Empty;
            // purposely put wrong length
            value_basicTLV_2.Length = 10;
            value_basicTLV_2.Tag = "09";

            composer_BasicTLV = new Composer();
            composer_BasicTLV.Vals.Add(value_basicTLV_1);
            composer_BasicTLV.Vals.Add(value_basicTLV_2);
        }