Browse Source

Fixed failing WixBinding tests after project system changes.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2058 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 19 years ago
parent
commit
c6b64b6445
  1. 14
      src/AddIns/BackendBindings/WixBinding/Project/Src/Project/WixProject.cs
  2. 8
      src/AddIns/BackendBindings/WixBinding/Project/Src/WixDirectoryElement.cs
  3. 10
      src/AddIns/BackendBindings/WixBinding/Test/Gui/AddDialogsToSetupDialogListTestFixture.cs
  4. 10
      src/AddIns/BackendBindings/WixBinding/Test/Gui/DeleteWixLibraryNodeTestFixture.cs
  5. 24
      src/AddIns/BackendBindings/WixBinding/Test/Project/CreateNewWixProjectObjectTestFixture.cs
  6. 28
      src/AddIns/BackendBindings/WixBinding/Test/Utils/WixBindingTestsHelper.cs

14
src/AddIns/BackendBindings/WixBinding/Project/Src/Project/WixProject.cs

@ -11,6 +11,7 @@ using System.Collections.ObjectModel; @@ -11,6 +11,7 @@ using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Project;
using Microsoft.Build.BuildEngine;
@ -50,8 +51,8 @@ namespace ICSharpCode.WixBinding @@ -50,8 +51,8 @@ namespace ICSharpCode.WixBinding
get { return WixLanguageBinding.LanguageName; }
}
public override ICSharpCode.SharpDevelop.Dom.LanguageProperties LanguageProperties {
get { return ICSharpCode.SharpDevelop.Dom.LanguageProperties.None; }
public override LanguageProperties LanguageProperties {
get { return LanguageProperties.None; }
}
public override void Start(bool withDebugging)
@ -110,9 +111,9 @@ namespace ICSharpCode.WixBinding @@ -110,9 +111,9 @@ namespace ICSharpCode.WixBinding
/// </summary>
public string InstallerFullPath {
get {
string outputPath = GetProperty("OutputPath") ?? "";
string outputType = GetProperty("OutputType") ?? "";
string outputName = GetProperty("OutputName") ?? "";
string outputPath = GetProperty("OutputPath") ?? String.Empty;
string outputType = GetProperty("OutputType") ?? String.Empty;
string outputName = GetProperty("OutputName") ?? String.Empty;
string fileName = String.Concat(outputName, GetInstallerExtension(outputType));
return Path.Combine(Path.Combine(Directory, outputPath), fileName);
}
@ -194,7 +195,8 @@ namespace ICSharpCode.WixBinding @@ -194,7 +195,8 @@ namespace ICSharpCode.WixBinding
/// <returns>An empty string if the name cannot be found.</returns>
public string GetVariable(string name)
{
NameValuePairCollection nameValuePairs = new NameValuePairCollection(GetProperty("DefineConstants"));
string constants = GetProperty("DefineConstants") ?? String.Empty;
NameValuePairCollection nameValuePairs = new NameValuePairCollection(constants);
return WixPropertyParser.Parse(nameValuePairs.GetValue(name), this);
}

8
src/AddIns/BackendBindings/WixBinding/Project/Src/WixDirectoryElement.cs

@ -52,14 +52,6 @@ namespace ICSharpCode.WixBinding @@ -52,14 +52,6 @@ namespace ICSharpCode.WixBinding
return rootDirectory;
}
/// <summary>
/// Adds a new component element to this directory element.
/// </summary>
public WixComponentElement AddComponent()
{
return AddComponent(String.Empty);
}
/// <summary>
/// Adds a new component element to this directory element.
/// </summary>

10
src/AddIns/BackendBindings/WixBinding/Test/Gui/AddDialogsToSetupDialogListTestFixture.cs

@ -45,6 +45,7 @@ namespace WixBinding.Tests.Gui @@ -45,6 +45,7 @@ namespace WixBinding.Tests.Gui
Color errorDialogTextBackColour;
bool hasErrors;
bool hasErrorsAtStart;
[TestFixtureSetUp]
public void SetUpFixture()
@ -55,6 +56,8 @@ namespace WixBinding.Tests.Gui @@ -55,6 +56,8 @@ namespace WixBinding.Tests.Gui
wixDocumentFileName = @"C:\Projects\Test\setup.wxs";
using (SetupDialogListView control = new SetupDialogListView()) {
control.AddDialogs(wixDocumentFileName, new ReadOnlyCollection<string>(dialogs));
hasErrorsAtStart = control.HasErrors;
XmlException xmlEx = new XmlException("Error occurred", null, 10, 5);
control.AddError(wixDocumentFileName, xmlEx);
Exception ex = new Exception("Error");
@ -196,6 +199,11 @@ namespace WixBinding.Tests.Gui @@ -196,6 +199,11 @@ namespace WixBinding.Tests.Gui
{
Assert.IsTrue(hasErrors, "SetupDialogListView.HasErrors should be true");
}
[Test]
public void HasErrorsAtStart()
{
Assert.IsFalse(hasErrorsAtStart, "SetupDialogListView.HasErrors should be false at the start");
}
}
}

10
src/AddIns/BackendBindings/WixBinding/Test/Gui/DeleteWixLibraryNodeTestFixture.cs

@ -29,7 +29,15 @@ namespace WixBinding.Tests.Gui @@ -29,7 +29,15 @@ namespace WixBinding.Tests.Gui
[TestFixtureSetUp]
public void SetUpFixture()
{
wixProject = WixBindingTestsHelper.CreateEmptyWixProject();
WixBindingTestsHelper.InitMSBuildEngine();
// create the project.
ProjectCreateInformation info = new ProjectCreateInformation();
info.Solution = new Solution();
info.ProjectName = "Test";
info.OutputProjectFileName = @"C:\Projects\Test\Test.wixproj";
wixProject = new WixProjectWithOverriddenSave(info);
// Add wix library item.
wixLibraryItem = new WixLibraryProjectItem(wixProject);

24
src/AddIns/BackendBindings/WixBinding/Test/Project/CreateNewWixProjectObjectTestFixture.cs

@ -5,11 +5,13 @@ @@ -5,11 +5,13 @@
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.WixBinding;
using NUnit.Framework;
using System;
using WixBinding.Tests.Utils;
namespace WixBinding.Tests.Project
{
@ -25,6 +27,8 @@ namespace WixBinding.Tests.Project @@ -25,6 +27,8 @@ namespace WixBinding.Tests.Project
[TestFixtureSetUp]
public void SetUpFixture()
{
WixBindingTestsHelper.InitMSBuildEngine();
info = new ProjectCreateInformation();
info.Solution = new Solution();
info.ProjectName = "Test";
@ -96,5 +100,23 @@ namespace WixBinding.Tests.Project @@ -96,5 +100,23 @@ namespace WixBinding.Tests.Project
{
Assert.AreEqual(info.OutputProjectFileName, project.FileName);
}
[Test]
public void AssemblyName()
{
Assert.AreEqual("Test", project.AssemblyName);
}
[Test]
public void UnknownProperty()
{
Assert.IsNull(project.GetValue("UnknownMSBuildProperty"));
}
[Test]
public void ProjectLanguageProperties()
{
Assert.AreEqual(LanguageProperties.None, project.LanguageProperties);
}
}
}

28
src/AddIns/BackendBindings/WixBinding/Test/Utils/WixBindingTestsHelper.cs

@ -10,6 +10,7 @@ using ICSharpCode.SharpDevelop.Project; @@ -10,6 +10,7 @@ using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.WixBinding;
using System;
using System.ComponentModel;
using System.IO;
namespace WixBinding.Tests.Utils
{
@ -27,6 +28,10 @@ namespace WixBinding.Tests.Utils @@ -27,6 +28,10 @@ namespace WixBinding.Tests.Utils
/// </summary>
public static WixProject CreateEmptyWixProject()
{
// Make sure the MSBuildEngine is initialised correctly.
InitMSBuildEngine();
// create the project.
ProjectCreateInformation info = new ProjectCreateInformation();
info.Solution = new Solution();
info.ProjectName = "Test";
@ -48,5 +53,28 @@ namespace WixBinding.Tests.Utils @@ -48,5 +53,28 @@ namespace WixBinding.Tests.Utils
}
return null;
}
/// <summary>
/// The MSBuildEngine sets the SharpDevelopBinPath so if
/// the SharpDevelop.Base assembly is shadow copied it refers
/// to the shadow copied assembly not the original. This
/// causes problems for wix projects that refer to the
/// wix.targets import via $(SharpDevelopBinPath) so here
/// we change it so it points to the real SharpDevelop
/// binary.
/// </summary>
public static void InitMSBuildEngine()
{
// Remove existing SharpDevelopBinPath property.
MSBuildEngine.MSBuildProperties.Remove("SharpDevelopBinPath");
// Set the SharpDevelopBinPath property so it points to
// the actual bin path where SharpDevelop was built not
// to the shadow copy folder.
string codeBase = typeof(MSBuildEngine).Assembly.CodeBase.Replace("file:///", String.Empty);
string folder = Path.GetDirectoryName(codeBase);
folder = Path.GetFullPath(Path.Combine(folder, @"..\"));
MSBuildEngine.MSBuildProperties["SharpDevelopBinPath"] = folder;
}
}
}

Loading…
Cancel
Save