public void TestContainsKey() {
      IObjectState state = new MutableObjectState {
        ServerData = new Dictionary<string, object>() {
          { "Len", "Kagamine" },
          { "Rin", "Kagamine" },
          { "3", "Halyosy" }
        }
      };

      Assert.True(state.ContainsKey("Len"));
      Assert.True(state.ContainsKey("Rin"));
      Assert.True(state.ContainsKey("3"));
      Assert.False(state.ContainsKey("Halyosy"));
      Assert.False(state.ContainsKey("Kagamine"));
    }
        public void TestACLCoding()
        {
            MutableObjectState state = (MutableObjectState)ParseObjectCoder.Instance.Decode(new Dictionary <string, object>
            {
                ["ACL"] = new Dictionary <string, object>
                {
                    ["3KmCvT7Zsb"] = new Dictionary <string, object>
                    {
                        ["read"]  = true,
                        ["write"] = true
                    },
                    ["*"] = new Dictionary <string, object> {
                        ["read"] = true
                    }
                }
            }, null);

            ParseACL resultACL = null;

            Assert.IsTrue(state.ContainsKey("ACL"));
            Assert.IsTrue((resultACL = state.ServerData["ACL"] as ParseACL) is ParseACL);
            Assert.IsTrue(resultACL.PublicReadAccess);
            Assert.IsFalse(resultACL.PublicWriteAccess);
            Assert.IsTrue(resultACL.GetWriteAccess("3KmCvT7Zsb"));
            Assert.IsTrue(resultACL.GetReadAccess("3KmCvT7Zsb"));
            Assert.IsFalse(resultACL.GetWriteAccess("*"));
            Assert.IsTrue(resultACL.GetReadAccess("*"));
        }
Пример #3
0
        public void TestContainsKey()
        {
            IObjectState state = new MutableObjectState {
                ServerData = new Dictionary <string, object>()
                {
                    { "Len", "Kagamine" },
                    { "Rin", "Kagamine" },
                    { "3", "Halyosy" }
                }
            };

            Assert.True(state.ContainsKey("Len"));
            Assert.True(state.ContainsKey("Rin"));
            Assert.True(state.ContainsKey("3"));
            Assert.False(state.ContainsKey("Halyosy"));
            Assert.False(state.ContainsKey("Kagamine"));
        }