Example #1
0
        public void CancelRemoveFromServerTest()
        {
            UserFields uf = new UserFields();

            uf.RemoveFromServer("field");
            uf.Remove("field");
            Assert.AreEqual(0, uf.RemovedFields.Length);
        }
Example #2
0
        public void RemoveAllTypeTest()
        {
            UserFields uf = new UserFields();

            uf["field1"]   = true;
            uf["field2"]   = new byte[] { 0x00 };
            uf["field3"]   = 10;
            uf["field4"]   = 10L;
            uf["field5"]   = 10.01;
            uf["field6"]   = "hoge";
            uf["field7"]   = new Uri("http://hoge.com/hoge");
            uf["field8"]   = new JsonObject("{}");
            uf["field9"]   = new JsonArray("[111,222]");
            uf.Displayname = "Displayname1";
            uf.Country     = "US";

            uf.Remove("field1");
            uf.Remove("field2");
            uf.Remove("field3");
            uf.Remove("field4");
            uf.Remove("field5");
            uf.Remove("field6");
            uf.Remove("field7");
            uf.Remove("field8");
            uf.Remove("field9");
            uf.RemoveDisplayname();
            uf.RemoveCountry();

            Assert.IsFalse(uf.Has("field1"));
            Assert.IsFalse(uf.Has("field2"));
            Assert.IsFalse(uf.Has("field3"));
            Assert.IsFalse(uf.Has("field4"));
            Assert.IsFalse(uf.Has("field5"));
            Assert.IsFalse(uf.Has("field6"));
            Assert.IsFalse(uf.Has("field7"));
            Assert.IsFalse(uf.Has("field8"));
            Assert.IsFalse(uf.Has("field9"));
            Assert.IsNull(uf.Displayname);
            Assert.IsNull(uf.Country);
        }
Example #3
0
        public void RemoveWithReservedKeyTest()
        {
            UserFields uf = new UserFields();

            foreach (string key in RESERVED_KEY)
            {
                try
                {
                    uf.Remove(key);
                    Assert.Fail("Exception is not thrown key=" + key);
                }
                catch (ArgumentException)
                {
                }
            }
        }