Author: msierad
Date: 2006-03-21 09:16:07 -0500 (Tue, 21 Mar 2006)
New Revision: 58218
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/InvalidProjectFileExceptionTest.cs
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
Log:
2006-03-21 Marek Sieradzki <[EMAIL PROTECTED]>
* InvalidProjectFileExceptionTest.cs, EngineTest.cs, ProjectTest.cs:
Updated tests.
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
===================================================================
---
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
2006-03-21 13:41:40 UTC (rev 58217)
+++
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
2006-03-21 14:16:07 UTC (rev 58218)
@@ -1,3 +1,8 @@
+2006-03-21 Marek Sieradzki <[EMAIL PROTECTED]>
+
+ * InvalidProjectFileExceptionTest.cs, EngineTest.cs, ProjectTest.cs:
+ Updated tests.
+
2006-03-18 Marek Sieradzki <[EMAIL PROTECTED]>
* InternalLoggerExceptionTest.cs, InvalidProjectFileExceptionTest.cs,
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs
2006-03-21 13:41:40 UTC (rev 58217)
+++
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs
2006-03-21 14:16:07 UTC (rev 58218)
@@ -25,21 +25,73 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+using System;
using Microsoft.Build.BuildEngine;
using NUnit.Framework;
namespace MonoTests.Microsoft.Build.BuildEngine {
[TestFixture]
public class EngineTest {
+
+ Engine engine;
+ string binPath;
+
+ [SetUp]
+ public void SetUp ()
+ {
+ binPath = "binPath";
+ }
+
[Test]
- public void TestAssignment ()
+ public void TestCtor ()
{
- Engine engine;
- string binPath = "binPath";
-
engine = new Engine (binPath);
-
- Assert.AreEqual (binPath, engine.BinPath, "BinPath");
}
+
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException),
+ @"Before a project can be instantiated, Engine.BinPath must be
set to the location on disk where MSBuild is installed. " +
+ "This is used to evaluate $(MSBuildBinPath).")]
+ public void TestNewProject ()
+ {
+ engine = new Engine ();
+
+ engine.CreateNewProject ();
+ }
+
+ [Test]
+ public void TestBinPath ()
+ {
+ engine = new Engine (binPath);
+
+ Assert.AreEqual (binPath, engine.BinPath, "A1");
+ }
+
+ [Test]
+ public void TestBuildEnabled ()
+ {
+ engine = new Engine (binPath);
+
+ Assert.AreEqual (true, engine.BuildEnabled, "A1");
+ }
+
+ [Test]
+ public void TestOnlyLogCriticalEvents ()
+ {
+ engine = new Engine (binPath);
+
+ Assert.AreEqual (false, engine.OnlyLogCriticalEvents,
"A1");
+ }
+
+ [Test]
+ public void TestGlobalProperties ()
+ {
+ engine = new Engine (binPath);
+
+ Assert.IsNotNull (engine.GlobalProperties, "A1");
+ Assert.AreEqual (0, engine.GlobalProperties.Count,
"A2");
+ Assert.AreEqual (String.Empty,
engine.GlobalProperties.Condition, "A3");
+ Assert.IsFalse (engine.GlobalProperties.IsImported,
"A4");
+ }
}
}
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/InvalidProjectFileExceptionTest.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/InvalidProjectFileExceptionTest.cs
2006-03-21 13:41:40 UTC (rev 58217)
+++
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/InvalidProjectFileExceptionTest.cs
2006-03-21 14:16:07 UTC (rev 58218)
@@ -63,15 +63,16 @@
ipfe = new InvalidProjectFileException (projectFile,
lineNumber, columnNumber, endLineNumber, endColumnNumber,
message, errorSubcategory, errorCode,
helpKeyword);
- Assert.AreEqual (projectFile, ipfe.ProjectFile,
"ProjectFile");
- Assert.AreEqual (lineNumber, ipfe.LineNumber,
"LineNumber");
- Assert.AreEqual (columnNumber, ipfe.ColumnNumber,
"ColumnNumber");
- Assert.AreEqual (endLineNumber, ipfe.EndLineNumber,
"EndLineNumber");
- Assert.AreEqual (endColumnNumber, ipfe.EndColumnNumber,
"EndColumnNumber");
- Assert.AreEqual (message, ipfe.Message, "Message");
- Assert.AreEqual (errorSubcategory,
ipfe.ErrorSubcategory, "ErrorSubcategory");
- Assert.AreEqual (errorCode, ipfe.ErrorCode,
"ErrorCode");
- Assert.AreEqual (helpKeyword, ipfe.HelpKeyword,
"HelpKeyword");
+ Assert.AreEqual (projectFile, ipfe.ProjectFile, "A1");
+ Assert.AreEqual (lineNumber, ipfe.LineNumber, "A2");
+ Assert.AreEqual (columnNumber, ipfe.ColumnNumber, "A3");
+ Assert.AreEqual (endLineNumber, ipfe.EndLineNumber,
"A4");
+ Assert.AreEqual (endColumnNumber, ipfe.EndColumnNumber,
"A5");
+ Assert.AreEqual (message, ipfe.BaseMessage, "A6");
+ Assert.AreEqual (message + " " + projectFile,
ipfe.Message, "A7");
+ Assert.AreEqual (errorSubcategory,
ipfe.ErrorSubcategory, "A8");
+ Assert.AreEqual (errorCode, ipfe.ErrorCode, "A9");
+ Assert.AreEqual (helpKeyword, ipfe.HelpKeyword, "A10");
}
[Test]
@@ -87,6 +88,7 @@
[Test]
public void TestCtorNode ()
{
+ // FIXME: we need to load xml file to load something
with non-empty XmlElement.BaseUri
/*
XmlDocument xd = new XmlDocument ();
@@ -99,10 +101,10 @@
ipfe = new InvalidProjectFileException (null, message,
errorSubcategory, errorCode, helpKeyword);
- Assert.AreEqual (message, ipfe.Message, "Message");
- Assert.AreEqual (errorSubcategory,
ipfe.ErrorSubcategory, "ErrorSubcategory");
- Assert.AreEqual (errorCode, ipfe.ErrorCode,
"ErrorCode");
- Assert.AreEqual (helpKeyword, ipfe.HelpKeyword,
"HelpKeyword");
+ Assert.AreEqual (message, ipfe.BaseMessage, "A1");
+ Assert.AreEqual (errorSubcategory,
ipfe.ErrorSubcategory, "A2");
+ Assert.AreEqual (errorCode, ipfe.ErrorCode, "A3");
+ Assert.AreEqual (helpKeyword, ipfe.HelpKeyword, "A4");
*/
}
}
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
2006-03-21 13:41:40 UTC (rev 58217)
+++
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
2006-03-21 14:16:07 UTC (rev 58218)
@@ -33,6 +33,15 @@
namespace MonoTests.Microsoft.Build.BuildEngine {
[TestFixture]
public class ProjectTest {
+
+ string binPath;
+
+ [SetUp]
+ public void SetUp ()
+ {
+ binPath = "binPath";
+ }
+
// Clones a project by reloading from original.Xml
private Project CloneProject (Project original)
{
@@ -45,19 +54,21 @@
}
[Test]
+ [ExpectedException (typeof (InvalidProjectFileException),
+ @"The default XML namespace of the project must be the MSBuild XML
namespace." +
+ " If the project is authored in the MSBuild 2003 format, please add " +
+ "xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" to the
<Project> element. " +
+ "If the project has been authored in the old 1.0 or 1.2 format, please
convert it to MSBuild 2003 format. ")]
public void TestAssignment ()
{
Engine engine;
Project project;
- string binPath = "binPath";
string documentString =
"<Project></Project>";
engine = new Engine (binPath);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
-
- Assert.AreEqual (String.Empty, project.FullFileName,
"A1");
}
[Test]
@@ -66,14 +77,16 @@
Engine engine;
Project proj;
Project cproj;
- string documentString =
- "<Project
DefaultTargets=\"Build;Compile\"></Project>";
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003""
DefaultTargets=""Build;Compile"">
+ </Project>
+ ";
- engine = new Engine ();
+ engine = new Engine (binPath);
proj = engine.CreateNewProject ();
proj.LoadXml (documentString);
- Assert.AreEqual ("Build;Compile", proj.DefaultTargets,
"A1");
+ Assert.AreEqual ("Build; Compile", proj.DefaultTargets,
"A1");
proj.DefaultTargets = "Build";
Assert.AreEqual ("Build", proj.DefaultTargets, "A2");
cproj = CloneProject (proj);
@@ -83,11 +96,11 @@
[Test]
public void TestListProperties ()
{
- Engine engine = new Engine ();
+ Engine engine = new Engine (binPath);
Project proj = engine.CreateNewProject ();
string documentString = @"
- <Project>
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<PropertyGroup>
<Prop1>value1</Prop1>
</PropertyGroup>
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches