コード例 #1
0
        public void FixtureInit()
        {
            ilMergeAvailable = File.Exists(
                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
                             @"Microsoft\ILMerge\ILMerge.exe"));

            MockBuild buildEngine = new MockBuild();

            testDirectory = TaskUtility.makeTestDirectory(buildEngine);

            ILMerge task = new ILMerge();

            task.BuildEngine = buildEngine;

            if (TaskUtility.CalledInBuildDirectory)
            {
                assemblyA   = Path.Combine(testDirectory, @"A.dll");
                assemblyB   = Path.Combine(testDirectory, @"B.dll");
                excludeFile = Path.Combine(testDirectory, @"ExcludeTypes.txt");
                keyFile     = Path.Combine(testDirectory, @"keypair.snk");
            }
            else
            {
                string config = TaskUtility.BuildConfiguration;
                string assDir = Path.GetFullPath(TaskUtility.AssemblyDirectory);
                assemblyA   = Path.GetFullPath(Path.Combine(assDir, @"..\..\ILMerge\A\bin\" + config + @"\A.dll"));
                assemblyB   = Path.GetFullPath(Path.Combine(assDir, @"..\..\ILMerge\B\bin\" + config + @"\B.dll"));
                excludeFile = Path.Combine(assDir, @"ILMerge\ExcludeTypes.txt");
                keyFile     = Path.Combine(assDir, @"ILMerge\keypair.snk");
            }

            inputAssemblies = TaskUtility.StringArrayToItemArray(assemblyA, assemblyB);
        }
コード例 #2
0
        public void FixtureInit()
        {
            MockBuild buildEngine = new MockBuild();

            TaskUtility.makeTestDirectory(buildEngine);
            _templateFilename = Path.Combine(TaskUtility.TestDirectory, typeof(TemplateFileTest).Name + ".txt");
        }
コード例 #3
0
ファイル: ILMergeTest.cs プロジェクト: 464884492/msbuildtasks
		public void FixtureInit()
		{
			MockBuild buildEngine = new MockBuild();

			this.testDirectory = TaskUtility.makeTestDirectory(buildEngine);

			if (TaskUtility.CalledInBuildDirectory)
			{
				this.assemblyA = Path.Combine(this.testDirectory, @"A.dll");
				this.assemblyB = Path.Combine(this.testDirectory, @"B.dll");
				this.excludeFile = Path.Combine(this.testDirectory, @"ExcludeTypes.txt");
				this.keyFile = Path.Combine(this.testDirectory, @"keypair.snk");
			}
			else
			{
				string config = TaskUtility.BuildConfiguration;
				string assDir = Path.GetFullPath(TaskUtility.AssemblyDirectory);
				this.assemblyA = Path.GetFullPath(Path.Combine(assDir, @"..\..\ILMerge\A\bin\" + config + @"\A.dll"));
				this.assemblyB = Path.GetFullPath(Path.Combine(assDir, @"..\..\ILMerge\B\bin\" + config + @"\B.dll"));
				this.excludeFile = Path.Combine(assDir, @"ILMerge\ExcludeTypes.txt");
				this.keyFile = Path.Combine(assDir, @"ILMerge\keypair.snk");
			}

			this.inputAssemblies = TaskUtility.StringArrayToItemArray(this.assemblyA, this.assemblyB);
		}
コード例 #4
0
 public void Setup()
 {
     MockBuild buildEngine = new MockBuild();
     testDirectory = TaskUtility.makeTestDirectory(buildEngine);
     task = new WebDownload();
     task.BuildEngine = new MockBuild();
 }
コード例 #5
0
ファイル: NUnitTest.cs プロジェクト: uzigula/msbuildtasks
        public void NUnitExecute()
        {
            #region Find NUnit installation
            string nunitPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
            nunitPath = Path.Combine(nunitPath, NUnit.DEFAULT_NUNIT_DIRECTORY);

            RegistryKey buildKey = Registry.ClassesRoot.OpenSubKey(@"NUnitTestProject\shell\open\command");
            if (buildKey == null)
            {
                Assert.Ignore(@"Can't find NUnit installation");
            }

            nunitPath = buildKey.GetValue(null, nunitPath).ToString();
            Regex nunitRegex = new Regex("(.+)nunit-gui\\.exe", RegexOptions.IgnoreCase);
            Match pathMatch  = nunitRegex.Match(nunitPath);
            nunitPath = pathMatch.Groups[1].Value.Replace("\"", "");

            #endregion Find NUnit installation

            MockBuild buildEngine = new MockBuild();

            string testDirectory = TaskUtility.makeTestDirectory(buildEngine);

            NUnit task = new NUnit();
            task.BuildEngine = buildEngine;
            task.Assemblies  = TaskUtility.StringArrayToItemArray(
                Path.Combine(nunitPath, "nunit.framework.tests.dll"));
            task.WorkingDirectory = testDirectory;
            task.OutputXmlFile    = Path.Combine(testDirectory, @"nunit.framework.tests-results.xml");
            Assert.IsTrue(task.Execute(), "Execute Failed");
        }
コード例 #6
0
ファイル: NUnitTest.cs プロジェクト: trippleflux/jezatools
        public void NUnitExecute()
        {
            #region Find NUnit installation
            string nunitPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
            nunitPath = Path.Combine(nunitPath, NUnit.DEFAULT_NUNIT_DIRECTORY);

            RegistryKey buildKey = Registry.ClassesRoot.OpenSubKey(@"NUnitTestProject\shell\open\command");
            if (buildKey == null) Assert.Ignore(@"Can't find NUnit installation");

            nunitPath = buildKey.GetValue(null, nunitPath).ToString();
            Regex nunitRegex = new Regex("(.+)nunit-gui\\.exe", RegexOptions.IgnoreCase);
            Match pathMatch = nunitRegex.Match(nunitPath);
            nunitPath = pathMatch.Groups[1].Value.Replace("\"", "");

            #endregion Find NUnit installation

            MockBuild buildEngine = new MockBuild();

            string testDirectory = TaskUtility.makeTestDirectory(buildEngine);

            NUnit task = new NUnit();
            task.BuildEngine = buildEngine;
            task.Assemblies = TaskUtility.StringArrayToItemArray(
                Path.Combine(nunitPath, "nunit.framework.tests.dll"));
            task.WorkingDirectory = testDirectory;
            task.OutputXmlFile = Path.Combine(testDirectory, @"nunit.framework.tests-results.xml");
            Assert.IsTrue(task.Execute(), "Execute Failed");
        }
コード例 #7
0
        public void FixtureInit()
        {
            MockBuild buildEngine = new MockBuild();

            this.testDirectory = TaskUtility.makeTestDirectory(buildEngine);

            if (TaskUtility.CalledInBuildDirectory)
            {
                this.assemblyA   = Path.Combine(this.testDirectory, @"A.dll");
                this.assemblyB   = Path.Combine(this.testDirectory, @"B.dll");
                this.excludeFile = Path.Combine(this.testDirectory, @"ExcludeTypes.txt");
                this.keyFile     = Path.Combine(this.testDirectory, @"keypair.snk");
            }
            else
            {
                string config = TaskUtility.BuildConfiguration;
                string assDir = Path.GetFullPath(TaskUtility.AssemblyDirectory);
                this.assemblyA   = Path.GetFullPath(Path.Combine(assDir, @"..\..\ILMerge\A\bin\" + config + @"\A.dll"));
                this.assemblyB   = Path.GetFullPath(Path.Combine(assDir, @"..\..\ILMerge\B\bin\" + config + @"\B.dll"));
                this.excludeFile = Path.Combine(assDir, @"ILMerge\ExcludeTypes.txt");
                this.keyFile     = Path.Combine(assDir, @"ILMerge\keypair.snk");
            }

            this.inputAssemblies = TaskUtility.StringArrayToItemArray(this.assemblyA, this.assemblyB);
        }
コード例 #8
0
        public void Setup()
        {
            MockBuild buildEngine = new MockBuild();

            testDirectory    = TaskUtility.makeTestDirectory(buildEngine);
            task             = new WebDownload();
            task.BuildEngine = new MockBuild();
        }
コード例 #9
0
 public void TemplateFileInvalidTemplate()
 {
     MockBuild build = new MockBuild();
     TemplateFile tf = new TemplateFile();
     tf.BuildEngine = build;
     tf.Template = new TaskItem("non_existant_file");
     tf.Tokens = GetTaskItems();
     Assert.IsFalse(tf.Execute());
     Assert.AreEqual(1, build.ErrorCount);
 }
コード例 #10
0
        public void TemplateFileInvalidTemplate()
        {
            MockBuild    build = new MockBuild();
            TemplateFile tf    = new TemplateFile();

            tf.BuildEngine = build;
            tf.Template    = new TaskItem("non_existant_file");
            tf.Tokens      = GetTaskItems();
            Assert.IsFalse(tf.Execute());
            Assert.AreEqual(1, build.ErrorCount);
        }
コード例 #11
0
        public void LogOnNoSourceFilesTest()
        {
            var task      = new Merge();
            var mockBuild = new MockBuild();

            task.BuildEngine = mockBuild;
            var result = task.Execute();

            Assert.IsTrue(result);
            Assert.That(mockBuild.MessageLog, Is.EqualTo(Resources.MergeCompleteNoSourceFiles + Environment.NewLine));
        }
コード例 #12
0
ファイル: ChecksumTest.cs プロジェクト: KGuetter/msbuildtasks
 public void Setup()
 {
   MockBuild buildEngine = new MockBuild();
   testDirectory = Path.Combine(TaskUtility.makeTestDirectory( buildEngine ), "ChecksumTest");
   Directory.CreateDirectory( testDirectory );
   // Create test file
   inputFiles = new string[2];
   inputFiles[0] = Path.Combine( testDirectory, "testFile1.txt" );
   inputFiles[1] = Path.Combine( testDirectory, "testFile2.txt" );
   File.WriteAllText( inputFiles[0], "foo\nbar" );
   File.WriteAllText( inputFiles[1], "test2\ntest2" );
 }
コード例 #13
0
        public void Setup()
        {
            MockBuild buildEngine = new MockBuild();

            testDirectory = Path.Combine(TaskUtility.makeTestDirectory(buildEngine), "ChecksumTest");
            Directory.CreateDirectory(testDirectory);
            // Create test file
            inputFiles    = new string[2];
            inputFiles[0] = Path.Combine(testDirectory, "testFile1.txt");
            inputFiles[1] = Path.Combine(testDirectory, "testFile2.txt");
            File.WriteAllText(inputFiles[0], "foo\nbar");
            File.WriteAllText(inputFiles[1], "test2\ntest2");
        }
コード例 #14
0
 public void TemplateFileDefault()
 {
     MockBuild build = new MockBuild();
     TemplateFile tf = new TemplateFile();
     tf.BuildEngine = build;
     tf.Template = new TaskItem(_templateFilename);
     tf.Tokens = GetTaskItems();
     Assert.IsTrue(tf.Execute());
     Assert.IsNotNull(tf.OutputFile);
     Assert.IsTrue(File.Exists(tf.OutputFile.ItemSpec));
     _replacedFilename = tf.OutputFile.ItemSpec;
     Assert.AreEqual(Path.ChangeExtension(_templateFilename, ".out"), _replacedFilename);
     string replaced = File.ReadAllText(tf.OutputFile.ItemSpec);
     Assert.AreEqual(_templateReplaced, replaced);
 }
コード例 #15
0
        public void TemplateFileNoTokens()
        {
            MockBuild    build = new MockBuild();
            TemplateFile tf    = new TemplateFile();

            tf.BuildEngine = build;
            tf.Template    = new TaskItem(_templateFilename);
            Assert.IsTrue(tf.Execute());
            Assert.IsNotNull(tf.OutputFile);
            Assert.IsTrue(File.Exists(tf.OutputFile.ItemSpec));
            _replacedFilename = tf.OutputFile.ItemSpec;
            Assert.AreEqual(Path.ChangeExtension(_templateFilename, ".out"), _replacedFilename);
            string replaced = File.ReadAllText(tf.OutputFile.ItemSpec);

            Assert.AreEqual(_template, replaced);
        }
コード例 #16
0
        public void Copy()
        {
            MockBuild buildEngine = new MockBuild();
            string testDirectory = TaskUtility.makeTestDirectory(buildEngine);

            RoboCopy copy = new RoboCopy();
            copy.BuildEngine = buildEngine;
            copy.SourceFolder = @"..\..\..\";
            copy.DestinationFolder = Path.Combine(testDirectory, "RoboCopy");
            copy.Mirror = true;
            copy.ExcludeFolders = new string[] { ".svn", "bin", "obj", "Test" };
            copy.ExcludeFiles = new string[] { "*.resx", "*.csproj", "*.webinfo", "*.log" };
            bool result = copy.Execute();

            Assert.IsTrue(result);
        }
コード例 #17
0
        public void FixtureInit()
        {
            MockBuild buildEngine = new MockBuild();

            testDirectory = TaskUtility.makeTestDirectory(buildEngine);

            // Create test files
            files    = new string[3];
            files[0] = Path.Combine(testDirectory, @"numberupdate.txt");
            files[1] = Path.Combine(testDirectory, @"versionupdate.txt");
            files[2] = Path.Combine(testDirectory, @"parsetestupdate.txt");

            File.WriteAllText(files[0], "1.0.0.0");
            File.WriteAllText(files[1], "1.0.0.0");
            File.WriteAllText(files[2], "Today's date is: @DATE@." + Environment.NewLine +
                              "In case you didn't understand, today's date is: @DATE@!");
        }
コード例 #18
0
        public void Copy()
        {
            MockBuild buildEngine   = new MockBuild();
            string    testDirectory = TaskUtility.makeTestDirectory(buildEngine);

            RoboCopy copy = new RoboCopy();

            copy.BuildEngine       = buildEngine;
            copy.SourceFolder      = @"..\..\..\";
            copy.DestinationFolder = Path.Combine(testDirectory, "RoboCopy");
            copy.Mirror            = true;
            copy.ExcludeFolders    = new string[] { ".svn", "bin", "obj", "Test" };
            copy.ExcludeFiles      = new string[] { "*.resx", "*.csproj", "*.webinfo", "*.log" };
            bool result = copy.Execute();

            Assert.IsTrue(result);
        }
コード例 #19
0
        public void FixtureInit()
        {
            MockBuild buildEngine = new MockBuild();

            testDirectory = TaskUtility.makeTestDirectory(buildEngine);

            // Create test files
            files = new string[3];
            files[0] = Path.Combine(testDirectory, @"numberupdate.txt");
            files[1] = Path.Combine(testDirectory, @"versionupdate.txt");
            files[2] = Path.Combine(testDirectory, @"parsetestupdate.txt");

            File.WriteAllText(files[0], "1.0.0.0");
            File.WriteAllText(files[1], "1.0.0.0");
            File.WriteAllText(files[2], "Today's date is: @DATE@." + Environment.NewLine +
                "In case you didn't understand, today's date is: @DATE@!");
        }
コード例 #20
0
        public void TemplateFileReplace()
        {
            MockBuild    build = new MockBuild();
            TemplateFile tf    = new TemplateFile();

            tf.BuildEngine    = build;
            tf.Template       = new TaskItem(_templateFilename);
            tf.OutputFilename = _templateFilename;
            tf.Tokens         = GetTaskItems();
            Assert.IsTrue(tf.Execute());
            Assert.IsNotNull(tf.OutputFile);
            Assert.IsTrue(File.Exists(tf.OutputFile.ItemSpec));
            _replacedFilename = tf.OutputFile.ItemSpec;
            Assert.AreEqual(_templateFilename, _replacedFilename);
            string replaced = File.ReadAllText(tf.OutputFile.ItemSpec);

            Assert.AreEqual(_templateReplaced, replaced);
        }
コード例 #21
0
        public void TemplateFileMissingToken()
        {
            MockBuild    build = new MockBuild();
            TemplateFile tf    = new TemplateFile();

            tf.BuildEngine = build;
            tf.Template    = new TaskItem(_templateFilename);
            tf.Tokens      = GetTaskItemsMissing();
            Assert.IsTrue(tf.Execute());
            Assert.IsNotNull(tf.OutputFile);
            Assert.IsTrue(File.Exists(tf.OutputFile.ItemSpec));
            _replacedFilename = tf.OutputFile.ItemSpec;
            Assert.AreEqual(Path.ChangeExtension(_templateFilename, ".out"), _replacedFilename);
            string replaced         = File.ReadAllText(tf.OutputFile.ItemSpec);
            string shouldBeReplaced = _template.Replace("${TemplateItem}", "**Item1**").Replace("${CASEInsenSiTiveTest}", "**Item3**");

            Assert.AreEqual(shouldBeReplaced, replaced);
        }
コード例 #22
0
ファイル: NUnitTest.cs プロジェクト: KGuetter/msbuildtasks
        public void NUnitExecuteWhenToolPathIsDefined(int majorVersion, int minorVersion, int number)
        {
            string nUnitDirName = string.Format("NUnit {0}.{1}.{2}", majorVersion, minorVersion, number);
            string nunitPath = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), nUnitDirName), "bin");
            if (!Directory.Exists(nunitPath))
            {
                Assert.Inconclusive("{0} - not found", nunitPath);
            }

            MockBuild buildEngine = new MockBuild();
            string testDirectory = TaskUtility.makeTestDirectory(buildEngine);

            NUnit task = new NUnit();
            task.ToolPath = nunitPath;
            task.BuildEngine = buildEngine;
            task.Assemblies = TaskUtility.StringArrayToItemArray(Path.Combine(nunitPath, "nunit.framework.tests.dll"));
            task.WorkingDirectory = testDirectory;
            Assert.IsTrue(task.Execute(), "Execute Failed");
        }
コード例 #23
0
        public void TemplateFileNewFilename()
        {
            MockBuild    build = new MockBuild();
            TemplateFile tf    = new TemplateFile();

            tf.BuildEngine = build;
            tf.Template    = new TaskItem(_templateFilename);
            string outputfile = Path.Combine(Path.GetDirectoryName(_templateFilename), "Replacement.file");

            tf.OutputFilename = outputfile;
            tf.Tokens         = GetTaskItems();
            Assert.IsTrue(tf.Execute());
            Assert.IsNotNull(tf.OutputFile);
            Assert.IsTrue(File.Exists(tf.OutputFile.ItemSpec));
            _replacedFilename = tf.OutputFile.ItemSpec;
            Assert.AreEqual(outputfile, _replacedFilename);
            string replaced = File.ReadAllText(tf.OutputFile.ItemSpec);

            Assert.AreEqual(_templateReplaced, replaced);
        }
コード例 #24
0
        public void NUnitExecuteWhenToolPathIsDefined(int majorVersion, int minorVersion, int number)
        {
            string nUnitDirName = string.Format("NUnit {0}.{1}.{2}", majorVersion, minorVersion, number);
            string nunitPath    = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), nUnitDirName), "bin");

            if (!Directory.Exists(nunitPath))
            {
                Assert.Inconclusive("{0} - not found", nunitPath);
            }

            MockBuild buildEngine   = new MockBuild();
            string    testDirectory = TaskUtility.makeTestDirectory(buildEngine);

            NUnit task = new NUnit();

            task.ToolPath         = nunitPath;
            task.BuildEngine      = buildEngine;
            task.Assemblies       = TaskUtility.StringArrayToItemArray(Path.Combine(nunitPath, "nunit.framework.tests.dll"));
            task.WorkingDirectory = testDirectory;
            Assert.IsTrue(task.Execute(), "Execute Failed");
        }
コード例 #25
0
ファイル: MoveTest.cs プロジェクト: niemyjski/msbuildtasks
 public void FixtureInit()
 {
     MockBuild buildEngine = new MockBuild();
     TaskUtility.makeTestDirectory(buildEngine);
 }
コード例 #26
0
 public void SetUp()
 {
     _mockBuild = new MockBuild();
     TaskUtility.makeTestDirectory(_mockBuild);
 }
コード例 #27
0
ファイル: MoveTest.cs プロジェクト: sihugh/msbuildtasks
        public void FixtureInit()
        {
            MockBuild buildEngine = new MockBuild();

            TaskUtility.makeTestDirectory(buildEngine);
        }
コード例 #28
0
		public void TemplateFileMissingToken()
		{
			MockBuild build = new MockBuild();
			TemplateFile tf = new TemplateFile();
			tf.BuildEngine = build;
			tf.Template = new TaskItem(_templateFilename);
			tf.Tokens = GetTaskItemsMissing();
			Assert.IsTrue(tf.Execute());
			Assert.IsNotNull(tf.OutputFile);
			Assert.IsTrue(File.Exists(tf.OutputFile.ItemSpec));
			_replacedFilename = tf.OutputFile.ItemSpec;
			Assert.AreEqual(Path.ChangeExtension(_templateFilename, ".out"), _replacedFilename);
			string replaced = File.ReadAllText(tf.OutputFile.ItemSpec);
			string shouldBeReplaced = _template.Replace("${TemplateItem}", "**Item1**").Replace("${CASEInsenSiTiveTest}", "**Item3**");
			Assert.AreEqual(shouldBeReplaced, replaced);
		}
コード例 #29
0
		public void TemplateFileNewFilename()
		{
			MockBuild build = new MockBuild();
			TemplateFile tf = new TemplateFile();
			tf.BuildEngine = build;
			tf.Template = new TaskItem(_templateFilename);
			string outputfile = Path.Combine(Path.GetDirectoryName(_templateFilename), "Replacement.file");
			tf.OutputFilename = outputfile;
			tf.Tokens = GetTaskItems();
			Assert.IsTrue(tf.Execute());
			Assert.IsNotNull(tf.OutputFile);
			Assert.IsTrue(File.Exists(tf.OutputFile.ItemSpec));
			_replacedFilename = tf.OutputFile.ItemSpec;
			Assert.AreEqual(outputfile, _replacedFilename);
			string replaced = File.ReadAllText(tf.OutputFile.ItemSpec);
			Assert.AreEqual(_templateReplaced, replaced);
		}
コード例 #30
0
 public void SetUp()
 {
     _mockBuild = new MockBuild();
     TaskUtility.makeTestDirectory(_mockBuild);
 }
コード例 #31
0
		public void FixtureInit()
		{
			MockBuild buildEngine = new MockBuild();
			TaskUtility.makeTestDirectory(buildEngine);
			_templateFilename = Path.Combine(TaskUtility.TestDirectory, typeof (TemplateFileTest).Name + ".txt");
		}
コード例 #32
0
ファイル: ILMergeTest.cs プロジェクト: trippleflux/jezatools
        public void FixtureInit()
        {
            this.isILMergeAvailable = File.Exists(Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
                @"Microsoft\ILMerge\ILMerge.exe"));

            MockBuild buildEngine = new MockBuild();

            this.testDirectory = TaskUtility.makeTestDirectory(buildEngine);

            ILMerge task = new ILMerge();
            task.BuildEngine = buildEngine;

            if (TaskUtility.CalledInBuildDirectory)
            {
                this.assemblyA = Path.Combine(this.testDirectory, @"A.dll");
                this.assemblyB = Path.Combine(this.testDirectory, @"B.dll");
                this.excludeFile = Path.Combine(this.testDirectory, @"ExcludeTypes.txt");
                this.keyFile = Path.Combine(this.testDirectory, @"keypair.snk");
            }
            else
            {
                string config = TaskUtility.BuildConfiguration;
                string assDir = Path.GetFullPath(TaskUtility.AssemblyDirectory);
                this.assemblyA = Path.GetFullPath(Path.Combine(assDir, @"..\..\ILMerge\A\bin\" + config + @"\A.dll"));
                this.assemblyB = Path.GetFullPath(Path.Combine(assDir, @"..\..\ILMerge\B\bin\" + config + @"\B.dll"));
                this.excludeFile = Path.Combine(assDir, @"ILMerge\ExcludeTypes.txt");
                this.keyFile = Path.Combine(assDir, @"ILMerge\keypair.snk");
            }

            this.inputAssemblies = TaskUtility.StringArrayToItemArray(this.assemblyA, this.assemblyB);
        }