Example #1
0
        override public void Run()
        {
            SdesData sdes = new SdesData("cName", "name");
            sdes.Email = "email";
            sdes.Location = "location";
            sdes.Note = "note";
            sdes.Phone = "phone";
            sdes.SetTool(true);
            sdes.SetPrivateExtension("prefix", "data");

            // Validate the properties we set
            if(sdes.CName != "cName"){throw new TestCaseException("Unexpected cName");}
            if(sdes.Name != "name"){throw new TestCaseException("Unexpected name");}
            if(sdes.Email != "email"){throw new TestCaseException("Unexpected email");}
            if(sdes.Location != "location"){throw new TestCaseException("Unexpected location");}
            if(sdes.Note != "note"){throw new TestCaseException("Unexpected note");}
            if(sdes.Phone != "phone"){throw new TestCaseException("Unexpected phone");}
            if(sdes.GetPrivateExtension("prefix") != "data"){throw new TestCaseException("Unexpected private extension");}

            // Serialize / Deserialize the data
            BufferChunk bc = new BufferChunk(Rtp.MAX_PACKET_SIZE);
            sdes.WriteDataToBuffer(bc);
            SdesData sdes2 = new SdesData(bc);

            if(sdes2.CName != "cName"){throw new TestCaseException("Unexpected cName");}
            if(sdes2.Name != "name"){throw new TestCaseException("Unexpected name");}
            if(sdes2.Email != "email"){throw new TestCaseException("Unexpected email");}
            if(sdes2.Location != "location"){throw new TestCaseException("Unexpected location");}
            if(sdes2.Note != "note"){throw new TestCaseException("Unexpected note");}
            if(sdes2.Phone != "phone"){throw new TestCaseException("Unexpected phone");}
            if(sdes2.GetPrivateExtension("prefix") != "data"){throw new TestCaseException("Unexpected private extension");}

            // Update the data
            sdes2.Name = "name2";
            if(!sdes.UpdateData(sdes2)){throw new TestCaseException("Update expected");}
            
            sdes2.SetPrivateExtension("prefix2", "data2");
            if(!sdes.UpdateData(sdes2)){throw new TestCaseException("Update expected");}

            Console.WriteLine(sdes.ToString());
        }
Example #2
0
        override public void Run()
        {
            SdesData sdes = new SdesData("cName", "name");

            sdes.Email    = "email";
            sdes.Location = "location";
            sdes.Note     = "note";
            sdes.Phone    = "phone";
            sdes.SetTool(true);
            sdes.SetPrivateExtension("prefix", "data");

            // Validate the properties we set
            if (sdes.CName != "cName")
            {
                throw new TestCaseException("Unexpected cName");
            }
            if (sdes.Name != "name")
            {
                throw new TestCaseException("Unexpected name");
            }
            if (sdes.Email != "email")
            {
                throw new TestCaseException("Unexpected email");
            }
            if (sdes.Location != "location")
            {
                throw new TestCaseException("Unexpected location");
            }
            if (sdes.Note != "note")
            {
                throw new TestCaseException("Unexpected note");
            }
            if (sdes.Phone != "phone")
            {
                throw new TestCaseException("Unexpected phone");
            }
            if (sdes.GetPrivateExtension("prefix") != "data")
            {
                throw new TestCaseException("Unexpected private extension");
            }

            // Serialize / Deserialize the data
            BufferChunk bc = new BufferChunk(Rtp.MAX_PACKET_SIZE);

            sdes.WriteDataToBuffer(bc);
            SdesData sdes2 = new SdesData(bc);

            if (sdes2.CName != "cName")
            {
                throw new TestCaseException("Unexpected cName");
            }
            if (sdes2.Name != "name")
            {
                throw new TestCaseException("Unexpected name");
            }
            if (sdes2.Email != "email")
            {
                throw new TestCaseException("Unexpected email");
            }
            if (sdes2.Location != "location")
            {
                throw new TestCaseException("Unexpected location");
            }
            if (sdes2.Note != "note")
            {
                throw new TestCaseException("Unexpected note");
            }
            if (sdes2.Phone != "phone")
            {
                throw new TestCaseException("Unexpected phone");
            }
            if (sdes2.GetPrivateExtension("prefix") != "data")
            {
                throw new TestCaseException("Unexpected private extension");
            }

            // Update the data
            sdes2.Name = "name2";
            if (!sdes.UpdateData(sdes2))
            {
                throw new TestCaseException("Update expected");
            }

            sdes2.SetPrivateExtension("prefix2", "data2");
            if (!sdes.UpdateData(sdes2))
            {
                throw new TestCaseException("Update expected");
            }

            Console.WriteLine(sdes.ToString());
        }