9 changed files with 159 additions and 10 deletions
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class DTE |
||||
{ |
||||
IPackageManagementProjectService projectService; |
||||
|
||||
public DTE() |
||||
: this(new PackageManagementProjectService()) |
||||
{ |
||||
} |
||||
|
||||
public DTE(IPackageManagementProjectService projectService) |
||||
{ |
||||
this.projectService = projectService; |
||||
} |
||||
|
||||
public Solution Solution { |
||||
get { |
||||
if (projectService.OpenSolution != null) { |
||||
return new Solution(projectService.OpenSolution); |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using SD = ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class Solution |
||||
{ |
||||
SD.Solution solution; |
||||
|
||||
public Solution(SD.Solution solution) |
||||
{ |
||||
this.solution = solution; |
||||
} |
||||
|
||||
public string FullName { |
||||
get { return solution.FileName; } |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,48 @@
@@ -0,0 +1,48 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.PackageManagement.Design; |
||||
using ICSharpCode.PackageManagement.EnvDTE; |
||||
using SD = ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
|
||||
namespace PackageManagement.Tests.EnvDTE |
||||
{ |
||||
[TestFixture] |
||||
public class DTETests |
||||
{ |
||||
DTE dte; |
||||
FakePackageManagementProjectService fakeProjectService; |
||||
|
||||
void CreateDTE() |
||||
{ |
||||
fakeProjectService = new FakePackageManagementProjectService(); |
||||
fakeProjectService.OpenSolution = new SD.Solution(); |
||||
dte = new DTE(fakeProjectService); |
||||
} |
||||
|
||||
[Test] |
||||
public void SolutionFullName_SolutionIsOpen_ReturnsSolutionFileName() |
||||
{ |
||||
CreateDTE(); |
||||
string fileName = @"d:\projects\myproject\myproject.sln"; |
||||
fakeProjectService.OpenSolution.FileName = fileName; |
||||
|
||||
string fullName = dte.Solution.FullName; |
||||
|
||||
Assert.AreEqual(fileName, fullName); |
||||
} |
||||
|
||||
[Test] |
||||
public void Solution_NoOpenSolution_ReturnsNull() |
||||
{ |
||||
CreateDTE(); |
||||
fakeProjectService.OpenSolution = null; |
||||
|
||||
var solution = dte.Solution; |
||||
|
||||
Assert.IsNull(solution); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue