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));
                }
        }
        public void Init()
        {
            args = new Dictionary <string, NSScriptCommandArgumentDescription> {
                { "firstArg", new NSScriptCommandArgumentDescription {
                      Name = "firstArg", AppleEventCode = "fArg", Type = "integer", IsOptional = true
                  } },
                { "secondArg", new NSScriptCommandArgumentDescription {
                      Name = "secondArg", AppleEventCode = "sArg", Type = "NSNumber"
                  } },
                { "thirdArg", new NSScriptCommandArgumentDescription {
                      Name = "thirdArg", AppleEventCode = "tArg", Type = "integer"
                  } }
            };

            suiteName        = "Chromium Suite";
            commandName      = "Exec Python";
            cmdClass         = "NSScriptCommand";
            eventCode        = "ExPy";
            eventClass       = "CrSu";
            returnType       = "NSString";
            resultAppleEvent = "text";
            dict             = new NSScriptCommandDescriptionDictionary {
                CommandClass        = cmdClass,
                AppleEventCode      = eventCode,
                AppleEventClassCode = eventClass,
                Type = returnType,
                ResultAppleEventCode = resultAppleEvent
            };

            foreach (var arg in args.Values)
            {
                dict.Add(arg);
            }
            scriptDescription = NSScriptCommandDescription.Create(suiteName, commandName, dict);
        }
        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));
        }
        public void TestCreateWithDictNullOrEmptyCommandName(string code)
        {
            var description = new NSScriptCommandDescriptionDictionary();

            NSScriptCommandDescription.Create(suiteName, code, description);
        }
        public void TestCreateWithDictWrongArgDescription()
        {
            var description = new NSScriptCommandDescriptionDictionary();

            NSScriptCommandDescription.Create(suiteName, commandName, description);
        }
        public void TestCreateWithDictNullDict()
        {
            NSScriptCommandDescriptionDictionary dict = null;

            NSScriptCommandDescription.Create(suiteName, commandName, dict);
        }
        public void TestCreateWithDictNullDict()
        {
            NSScriptCommandDescriptionDictionary dict = null;

            Assert.Throws <ArgumentNullException> (() => NSScriptCommandDescription.Create(suiteName, commandName, dict));
        }
        public void TestCreateWithDictNullOrEmptyCommandName(string code)
        {
            var description = new NSScriptCommandDescriptionDictionary();

            Assert.Throws <ArgumentException> (() => NSScriptCommandDescription.Create(suiteName, code, description));
        }
        public void TestCreateWithDictWrongArgDescription()
        {
            var description = new NSScriptCommandDescriptionDictionary();

            Assert.Throws <ArgumentException> (() => NSScriptCommandDescription.Create(suiteName, commandName, description));
        }