Esempio n. 1
0
        void TestExecuteTask(PDictionary input, PropertyListEditorAction action, string entry, string type, string value, PObject expected)
        {
            var task = CreateTask <PropertyListEditor> ();

            task.PropertyList = Path.Combine(Cache.CreateTemporaryDirectory(), "propertyList.plist");
            task.Action       = action.ToString();
            task.Entry        = entry;
            task.Type         = type;
            task.Value        = value;
            input.Save(task.PropertyList);

            if (expected == null)
            {
                Assert.IsFalse(task.Execute(), "Task was expected to fail.");
                return;
            }

            Assert.IsTrue(task.Execute(), "Task was expected to execute successfully.");

            var output = PObject.FromFile(task.PropertyList);

            Assert.AreEqual(expected.Type, output.Type, "Task produced the incorrect plist output.");

            CheckValue(output, expected);
        }
        static void TestExecuteTask(PDictionary input, PropertyListEditorAction action, string entry, string type, string value, PObject expected)
        {
            var task = new PropertyListEditor {
                PropertyList = Path.GetTempFileName(),
                BuildEngine  = new TestEngine(),
                Action       = action.ToString(),
                Entry        = entry,
                Type         = type,
                Value        = value
            };

            input.Save(task.PropertyList);

            try {
                if (expected == null)
                {
                    Assert.IsFalse(task.Execute(), "Task was expected to fail.");
                    return;
                }

                Assert.IsTrue(task.Execute(), "Task was expected to execute successfully.");

                var output = PObject.FromFile(task.PropertyList);

                Assert.AreEqual(expected.Type, output.Type, "Task produced the incorrect plist output.");

                CheckValue(output, expected);
            } finally {
                File.Delete(task.PropertyList);
            }
        }