public void RemoveArgument()
        {
            var arg = new NSScriptCommandArgumentDescription()
            {
                AppleEventCode = "frgt", Type = "text", Name = "Foo"
            };
            var desc = new NSScriptCommandDescriptionDictionary()
            {
                Arguments = new NSMutableDictionary()
            };

            // no exception should happen
            desc.Add(arg);
            using (var argKey = new NSString("Arguments"))
                using (var nsName = new NSString(arg.Name)) {
                    Assert.IsTrue(desc.Dictionary.ContainsKey(argKey));
                    var argDict = desc.Dictionary [argKey] as NSDictionary;
                    Assert.IsNotNull(argDict);
                    Assert.IsTrue(argDict.ContainsKey(nsName));
                }
            desc.Remove(arg);
            using (var argKey = new NSString("Arguments"))
                using (var nsName = new NSString(arg.Name)) {
                    Assert.IsTrue(desc.Dictionary.ContainsKey(argKey));
                    var argDict = desc.Dictionary [argKey] as NSDictionary;
                    Assert.IsNotNull(argDict);
                    Assert.IsFalse(argDict.ContainsKey(nsName));
                }
        }
Beispiel #2
0
        public void TestDescription(string name, string code, string type, bool isOptional)
        {
            var arg         = new NSScriptCommandArgumentDescription(name, code, type, isOptional);
            var description = arg.Dictionary;

            Assert.AreEqual(code, description [new NSString("AppleEventCode")].ToString());
            Assert.AreEqual(type, description [new NSString("Type")].ToString());
            Assert.AreEqual(isOptional? "Yes" : "No", description [new NSString("Optional")].ToString());
        }
        public void TestRemoveNoArguments()
        {
            var arg = new NSScriptCommandArgumentDescription()
            {
                AppleEventCode = "frgt", Type = "text", Name = "Foo"
            };
            var desc = new NSScriptCommandDescriptionDictionary();

            // no exception should happen
            Assert.IsFalse(desc.Remove(arg));
        }