Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6049 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
16 changed files with 97 additions and 132 deletions
@ -1,44 +0,0 @@
@@ -1,44 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.SharpDevelop.Project.Commands; |
||||
|
||||
namespace ICSharpCode.UnitTesting |
||||
{ |
||||
/// <summary>
|
||||
/// Custom build command that makes sure errors and warnings
|
||||
/// are not cleared from the Errors list before every build since
|
||||
/// we may be running multiple tests after each other.
|
||||
/// </summary>
|
||||
public class BuildProjectBeforeTestRun : BuildProjectBeforeExecute |
||||
{ |
||||
IUnitTestSaveAllFilesCommand saveAllFilesCommand; |
||||
|
||||
public BuildProjectBeforeTestRun(IProject targetProject, |
||||
IUnitTestSaveAllFilesCommand saveAllFilesCommand) |
||||
: base(targetProject) |
||||
{ |
||||
this.saveAllFilesCommand = saveAllFilesCommand; |
||||
} |
||||
|
||||
public BuildProjectBeforeTestRun(IProject targetProject) |
||||
: this(targetProject, new UnitTestSaveAllFilesCommand()) |
||||
{ |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Before a build do not clear the tasks, just save any
|
||||
/// dirty files.
|
||||
/// </summary>
|
||||
public override void BeforeBuild() |
||||
{ |
||||
saveAllFilesCommand.SaveAllFiles(); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <author name="Daniel Grunwald"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.UnitTesting |
||||
{ |
||||
/// <summary>
|
||||
/// IBuildable implementation that builds several projects.
|
||||
/// </summary>
|
||||
public class MultipleProjectBuildable : IBuildable |
||||
{ |
||||
readonly IBuildable[] projects; |
||||
|
||||
public MultipleProjectBuildable(IEnumerable<IBuildable> projects) |
||||
{ |
||||
this.projects = projects.ToArray(); |
||||
} |
||||
|
||||
public string Name { |
||||
get { return string.Empty; } |
||||
} |
||||
|
||||
public Solution ParentSolution { |
||||
get { return projects.Length > 0 ? projects[0].ParentSolution : null; } |
||||
} |
||||
|
||||
public ICollection<IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) |
||||
{ |
||||
return projects; |
||||
} |
||||
|
||||
public void StartBuild(ProjectBuildOptions buildOptions, IBuildFeedbackSink feedbackSink) |
||||
{ |
||||
// SharpDevelop already has built our dependencies, so we're done immediately.
|
||||
feedbackSink.Done(true); |
||||
} |
||||
|
||||
public ProjectBuildOptions CreateProjectBuildOptions(BuildOptions options, bool isRootBuildable) |
||||
{ |
||||
return null; |
||||
} |
||||
} |
||||
} |
||||
@ -1,50 +0,0 @@
@@ -1,50 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.UnitTesting; |
||||
using NUnit.Framework; |
||||
using UnitTesting.Tests.Utils; |
||||
|
||||
namespace UnitTesting.Tests.Tree |
||||
{ |
||||
[TestFixture] |
||||
public class BuildProjectBeforeTestRunTestFixture |
||||
{ |
||||
BuildProjectBeforeTestRun buildProjectBeforeTestRun; |
||||
MockSaveAllFilesCommand saveAllFilesCommand; |
||||
MockCSharpProject project; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
if (!PropertyService.Initialized) { |
||||
PropertyService.InitializeServiceForUnitTests(); |
||||
} |
||||
saveAllFilesCommand = new MockSaveAllFilesCommand(); |
||||
project = new MockCSharpProject(); |
||||
BuildResults buildResults = new BuildResults(); |
||||
|
||||
buildProjectBeforeTestRun = new BuildProjectBeforeTestRun(project, saveAllFilesCommand); |
||||
} |
||||
|
||||
[Test] |
||||
public void SaveAllFilesCommandNotCalledInitially() |
||||
{ |
||||
Assert.IsFalse(saveAllFilesCommand.IsSaveAllFilesMethodCalled); |
||||
} |
||||
|
||||
[Test] |
||||
public void BeforeBuildMethodSavesAllFiles() |
||||
{ |
||||
buildProjectBeforeTestRun.BeforeBuild(); |
||||
Assert.IsTrue(saveAllFilesCommand.IsSaveAllFilesMethodCalled); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue