2 // ResolveAssemblyReferenceTest.cs
5 // Marek Sieradzki (marek.sieradzki@gmail.com)
7 // (C) 2006 Marek Sieradzki
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using System.Collections;
30 using Microsoft.Build.BuildEngine;
31 using Microsoft.Build.Framework;
32 using Microsoft.Build.Tasks;
33 using Microsoft.Build.Utilities;
34 using NUnit.Framework;
36 namespace MonoTests.Microsoft.Build.Tasks {
39 public class ResolveAssemblyReferenceTest {
46 [Ignore ("it won't succeed if mono is not installed")]
47 public void TestGac1 ()
49 string documentString = @"
50 <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
52 <Reference Include='System' />
56 {CandidateAssemblyFiles};
59 {TargetFrameworkDirectory};
67 <ResolveAssemblyReference
68 Assemblies='@(Reference)'
69 SearchPaths='$(SearchPaths)'
71 <Output TaskParameter='ResolvedFiles' ItemName='ResolvedFiles'/>
72 </ResolveAssemblyReference>
77 engine = new Engine (Consts.BinPath);
78 project = engine.CreateNewProject ();
79 project.LoadXml (documentString);
81 Assert.IsTrue (project.Build ("A"), "A1");
82 big = project.GetEvaluatedItemsByName ("ResolvedFiles");
83 Assert.AreEqual (1, big.Count, "A2");
84 Assert.IsTrue (big [0].Include.EndsWith (".dll"), "A3");
88 [Ignore ("it won't succeed if mono is not installed")]
89 public void TestHintPath1 ()
91 string documentString = @"
92 <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
94 <Reference Include='test'>
95 <HintPath>Test\resources\test.dll</HintPath>
100 {CandidateAssemblyFiles};
103 {TargetFrameworkDirectory};
111 <ResolveAssemblyReference
112 Assemblies='@(Reference)'
113 SearchPaths='$(SearchPaths)'
115 <Output TaskParameter='ResolvedFiles' ItemName='ResolvedFiles'/>
116 </ResolveAssemblyReference>
121 engine = new Engine (Consts.BinPath);
122 project = engine.CreateNewProject ();
123 project.LoadXml (documentString);
125 Assert.IsTrue (project.Build ("A"), "A1");
126 big = project.GetEvaluatedItemsByName ("ResolvedFiles");
127 Assert.AreEqual (1, big.Count, "A2");
128 Assert.IsTrue (big [0].Include.EndsWith (".dll"), "A3");