Exemplo n.º 1
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);
        }