Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2938 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
5 changed files with 463 additions and 1 deletions
@ -0,0 +1,270 @@ |
|||||||
|
// <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 System.Collections.Generic; |
||||||
|
using System.Collections.ObjectModel; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Tests.StringTagProvider |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Mock IProject implementation to test the SharpDevelopStringTagProvider.
|
||||||
|
/// </summary>
|
||||||
|
public class MockProjectForTagProvider : IProject |
||||||
|
{ |
||||||
|
string fileName = String.Empty; |
||||||
|
string directory = String.Empty; |
||||||
|
string outputAssemblyFullPath = String.Empty; |
||||||
|
string name = String.Empty; |
||||||
|
|
||||||
|
public MockProjectForTagProvider() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public ReadOnlyCollection<ProjectItem> Items { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public ICollection<ItemType> AvailableFileItemTypes { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public List<ProjectSection> ProjectSections { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public LanguageProperties LanguageProperties { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string FileName { |
||||||
|
get { return fileName; } |
||||||
|
set { fileName = value; } |
||||||
|
} |
||||||
|
|
||||||
|
public string Directory { |
||||||
|
get { return directory; } |
||||||
|
set { directory = value; } |
||||||
|
} |
||||||
|
|
||||||
|
public string AssemblyName { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
set { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string RootNamespace { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
set { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string OutputAssemblyFullPath { |
||||||
|
get { return outputAssemblyFullPath; } |
||||||
|
set { outputAssemblyFullPath = value; } |
||||||
|
} |
||||||
|
|
||||||
|
public string Language { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string AppDesignerFolder { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string ActiveConfiguration { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
set { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string ActivePlatform { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
set { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public ICollection<string> ConfigurationNames { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public ICollection<string> PlatformNames { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public bool IsStartable { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int MinimumSolutionVersion { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public object SyncRoot { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public ISolutionFolderContainer Parent { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
set { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public Solution ParentSolution { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string TypeGuid { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
set { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string IdGuid { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
set { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string Location { |
||||||
|
get { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
set { |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string Name { |
||||||
|
get { return name; } |
||||||
|
set { name = value; } |
||||||
|
} |
||||||
|
|
||||||
|
public IEnumerable<ProjectItem> GetItemsOfType(ItemType type) |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public ItemType GetDefaultItemType(string fileName) |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public ICSharpCode.SharpDevelop.Dom.IAmbience GetAmbience() |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public void Save() |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public bool IsFileInProject(string fileName) |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public FileProjectItem FindFile(string fileName) |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public void Start(bool withDebugging) |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public ParseProjectContent CreateProjectContent() |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public ProjectItem CreateProjectItem(Microsoft.Build.BuildEngine.BuildItem item) |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public void ResolveAssemblyReferences() |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public ICollection<IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public void StartBuild(ProjectBuildOptions buildOptions, IBuildFeedbackSink feedbackSink) |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public void Dispose() |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public Properties CreateMemento() |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
public void SetMemento(ICSharpCode.Core.Properties memento) |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,72 @@ |
|||||||
|
// <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.Commands; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Tests.StringTagProvider |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests the SharpDevelopStringTagProvider when there is no active project.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class NullProjectStringTagProviderTestFixture |
||||||
|
{ |
||||||
|
SharpDevelopStringTagProvider tagProvider; |
||||||
|
|
||||||
|
[SetUp] |
||||||
|
public void Init() |
||||||
|
{ |
||||||
|
ProjectService.CurrentProject = null; |
||||||
|
tagProvider = new SharpDevelopStringTagProvider(); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertCurrentProjectName() |
||||||
|
{ |
||||||
|
Assert.AreEqual("<no current project>", tagProvider.Convert("CurrentProjectName")); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertTargetPath() |
||||||
|
{ |
||||||
|
Assert.AreEqual(String.Empty, tagProvider.Convert("TargetPath")); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertTargetDir() |
||||||
|
{ |
||||||
|
Assert.AreEqual(String.Empty, tagProvider.Convert("TargetDir")); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertTargetName() |
||||||
|
{ |
||||||
|
Assert.AreEqual(String.Empty, tagProvider.Convert("TargetName")); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertTargetExt() |
||||||
|
{ |
||||||
|
Assert.AreEqual(String.Empty, tagProvider.Convert("TargetExt")); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertProjectDir() |
||||||
|
{ |
||||||
|
Assert.AreEqual(String.Empty, tagProvider.Convert("ProjectDir")); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertProjectFileName() |
||||||
|
{ |
||||||
|
Assert.AreEqual(String.Empty, tagProvider.Convert("ProjectFileName")); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,116 @@ |
|||||||
|
// <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 System.IO; |
||||||
|
using ICSharpCode.SharpDevelop.Commands; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Tests.StringTagProvider |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests the SharpDevelopStringTagProvider when there is an active project.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class ProjectTagsTestFixture |
||||||
|
{ |
||||||
|
SharpDevelopStringTagProvider tagProvider; |
||||||
|
MockProjectForTagProvider project; |
||||||
|
|
||||||
|
[SetUp] |
||||||
|
public void Init() |
||||||
|
{ |
||||||
|
project = new MockProjectForTagProvider(); |
||||||
|
project.FileName = @"C:\Projects\MyProject\MyProject.csproj"; |
||||||
|
project.Directory = @"C:\Projects\MyProject"; |
||||||
|
project.OutputAssemblyFullPath = @"C:\Projects\MyProject\bin\Debug\MyProject.exe"; |
||||||
|
project.Name = "MyProject"; |
||||||
|
|
||||||
|
ProjectService.CurrentProject = project; |
||||||
|
tagProvider = new SharpDevelopStringTagProvider(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sanity check the mock project implementation.
|
||||||
|
/// </summary>
|
||||||
|
[Test] |
||||||
|
public void MockProjectFileName() |
||||||
|
{ |
||||||
|
Assert.AreEqual(@"C:\Projects\MyProject\MyProject.csproj", project.FileName); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sanity check the mock project implementation.
|
||||||
|
/// </summary>
|
||||||
|
[Test] |
||||||
|
public void MockProjectDirectory() |
||||||
|
{ |
||||||
|
Assert.AreEqual(@"C:\Projects\MyProject", project.Directory); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sanity check the mock project implementation.
|
||||||
|
/// </summary>
|
||||||
|
[Test] |
||||||
|
public void MockProjectOutputAssemblyFullPath() |
||||||
|
{ |
||||||
|
Assert.AreEqual(@"C:\Projects\MyProject\bin\Debug\MyProject.exe", project.OutputAssemblyFullPath); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sanity check the mock project implementation.
|
||||||
|
/// </summary>
|
||||||
|
[Test] |
||||||
|
public void MockProjectName() |
||||||
|
{ |
||||||
|
Assert.AreEqual("MyProject", project.Name); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertCurrentProjectName() |
||||||
|
{ |
||||||
|
Assert.AreEqual(project.Name, tagProvider.Convert("CurrentProjectName")); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertTargetPath() |
||||||
|
{ |
||||||
|
Assert.AreEqual(project.OutputAssemblyFullPath, tagProvider.Convert("TargetPath")); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertTargetDir() |
||||||
|
{ |
||||||
|
Assert.AreEqual(Path.GetDirectoryName(project.OutputAssemblyFullPath), tagProvider.Convert("TargetDir")); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertTargetName() |
||||||
|
{ |
||||||
|
Assert.AreEqual("MyProject.exe", tagProvider.Convert("TargetName")); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertTargetExt() |
||||||
|
{ |
||||||
|
Assert.AreEqual(".exe", tagProvider.Convert("TargetExt")); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertProjectDir() |
||||||
|
{ |
||||||
|
Assert.AreEqual(project.Directory, tagProvider.Convert("ProjectDir")); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertProjectFileName() |
||||||
|
{ |
||||||
|
Assert.AreEqual(Path.GetFileName(project.FileName), tagProvider.Convert("ProjectFileName")); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue