public ParseRole(string name, ParseACL control) : this() { Name = name; ACL = control; }
/// <summary> /// Constructs a new ParseRole with the given name. /// </summary> /// <param name="name">The name of the role to create.</param> /// <param name="acl">The ACL for this role. Roles must have an ACL.</param> public ParseRole(string name, ParseACL acl) : this() { Name = name; ACL = acl; }
public void TestEncodeACL() { ParseACL acl1 = new ParseACL(); IDictionary<string, object> value1 = ParseEncoderTestClass.Instance.Encode(acl1) as IDictionary<string, object>; Assert.IsNotNull(value1); Assert.AreEqual(0, value1.Keys.Count); ParseACL acl2 = new ParseACL(); acl2.PublicReadAccess = true; acl2.PublicWriteAccess = true; IDictionary<string, object> value2 = ParseEncoderTestClass.Instance.Encode(acl2) as IDictionary<string, object>; Assert.AreEqual(1, value2.Keys.Count); IDictionary<string, object> publicAccess = value2["*"] as IDictionary<string, object>; Assert.AreEqual(2, publicAccess.Keys.Count); Assert.IsTrue((bool)publicAccess["read"]); Assert.IsTrue((bool)publicAccess["write"]); // TODO (hallucinogen): mock ParseUser and test SetReadAccess and SetWriteAccess }
public void TestIndexGetterSetter() { ParseObject obj = ParseObject.Create("Corgi"); obj["gogo"] = true; obj["list"] = new List<string>(); obj["dict"] = new Dictionary<string, object>(); obj["fakeACL"] = new ParseACL(); obj["obj"] = new ParseObject("Corgi"); Assert.True(obj.ContainsKey("gogo")); Assert.IsInstanceOf<bool>(obj["gogo"]); Assert.True(obj.ContainsKey("list")); Assert.IsInstanceOf<IList<string>>(obj["list"]); Assert.True(obj.ContainsKey("dict")); Assert.IsInstanceOf<IDictionary<string, object>>(obj["dict"]); Assert.True(obj.ContainsKey("fakeACL")); Assert.IsInstanceOf<ParseACL>(obj["fakeACL"]); Assert.True(obj.ContainsKey("obj")); Assert.IsInstanceOf<ParseObject>(obj["obj"]); Assert.Throws<KeyNotFoundException>(() => { var gogo = obj["missingItem"]; }); }