Exemplo n.º 1
0
        /// <summary>
        /// NUNIT Tests the removal of nodes.
        /// </summary>
        [Test] public void TestRemove()
        {
            Assert.IsTrue(_base.Remove("CLAIM/INSURED/VEHICLE"));
            Assert.IsFalse(_base.Remove("CLAIM/INSURED/DRIVER/PHONE"));

            Console.WriteLine("{0}", _base);
            Assert.AreEqual(_base.Value, "");
        }
Exemplo n.º 2
0
        public void TestNameValues()
        {
            const string accountId = "ACCOUNT_ID";
            const string policyId  = "POLICY_ID";

            _base.SetValue(accountId, "12345");
            _base.SetValue(policyId, "678910");

            var copyCall = new CallObject();

            copyCall.LoadFromXml(_base.ToXml());
            Assert.IsNotEmpty(copyCall.GetValue(accountId));
            Assert.IsNotEmpty(copyCall.GetValue(policyId));
            copyCall.Remove(policyId);
            Assert.IsEmpty(copyCall.GetValue(policyId));

            // subtract method
            var items = _base.ToNameValueCollection();

            foreach (var key in items.AllKeys)
            {
                if (string.IsNullOrEmpty(copyCall.GetValue(key)))
                {
                    _base.Remove(key);
                }
            }
            Assert.IsEmpty(_base.GetValue(policyId));
            Console.WriteLine(_base);
        }