Esempio n. 1
0
        public void Execute()
        {
            // Get a mock compiler
            ICompiler compiler = CreateMockCompiler();

            IronPythonCompilerTask task = new IronPythonCompilerTask(compiler);
            // Create a fake engine as the logger will call into it
            Type     engineType = GenericMockFactory.CreateType("MockBuildEngine", new Type[] { typeof(Microsoft.Build.Framework.IBuildEngine) });
            BaseMock mockEngine = (BaseMock)Activator.CreateInstance(engineType);

            task.BuildEngine = (Microsoft.Build.Framework.IBuildEngine)mockEngine;

            // Set parameters
            task.SourceFiles   = new string[] { "Foo.py", "bar.py" };
            task.TargetKind    = "exe";
            task.MainFile      = "Foo.py";
            task.ResourceFiles = null;
            Microsoft.Build.Framework.ITaskItem[] resources = new Microsoft.Build.Framework.ITaskItem[1];
            resources[0]       = new Microsoft.Build.Utilities.TaskItem(@"obj\i386\form1.resources");
            task.ResourceFiles = resources;
            // Execute
            bool result = task.Execute();

            // Validation
            Assert.IsTrue(result);
            BaseMock mock = (BaseMock)compiler;

            Assert.AreEqual(PEFileKinds.ConsoleApplication, mock["TargetKind"]);
            Assert.AreEqual(task.MainFile, mock["MainFile"]);
        }
Esempio n. 2
0
        public void TargetKind()
        {
            IronPythonCompilerTask task = new IronPythonCompilerTask();
            // Set item
            string peKind = "library";

            task.TargetKind = peKind;
            // Verify what we added is preserved
            Assert.AreEqual(peKind, task.TargetKind, "TargetKind not preserved");
        }
Esempio n. 3
0
        public void MainFile()
        {
            IronPythonCompilerTask task = new IronPythonCompilerTask();
            // Set item
            string mainFile = "BlaFile";

            task.MainFile = mainFile;
            // Verify what we added is preserved
            Assert.AreEqual(mainFile, task.MainFile, "MainFile not preserved");
        }
Esempio n. 4
0
        public void OutputAssembly()
        {
            IronPythonCompilerTask task = new IronPythonCompilerTask();
            // Set item
            string outputAssembly = "Something.dll";

            task.OutputAssembly = outputAssembly;
            // Verify what we added is preserved
            Assert.AreEqual(outputAssembly, task.OutputAssembly, "OutputAssembly not preserved");
        }
Esempio n. 5
0
        public void SourceFiles()
        {
            IronPythonCompilerTask task = new IronPythonCompilerTask();

            // Set item
            string[] sourceFiles = new string[] { "Foo.py", "bar.py" };
            task.SourceFiles = sourceFiles;

            Assert.AreEqual(sourceFiles, task.SourceFiles, "Source files not persisted");
        }
Esempio n. 6
0
        public void ReferencedAssemblies()
        {
            IronPythonCompilerTask task = new IronPythonCompilerTask();

            // Set item
            task.ReferencedAssemblies = null;
            // Verify what we added is preserved
            Assert.IsNotNull(task.ReferencedAssemblies, "References should not be null");
            Assert.AreEqual(0, task.ReferencedAssemblies.Length, "References should be empty");
        }
Esempio n. 7
0
        public void DebugSymbols()
        {
            IronPythonCompilerTask task = new IronPythonCompilerTask();
            // Set item
            bool debugInformation = true;

            task.DebugSymbols = debugInformation;
            // Verify what we added is preserved
            Assert.AreEqual(debugInformation, task.DebugSymbols, "DebugSymbols not preserved");
        }
Esempio n. 8
0
        public void Instantiation1()
        {
            IronPythonCompilerTask task = new IronPythonCompilerTask();

            Assert.IsNotNull(task);
        }