Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Implement EnvDTE.SolutionBuild.ActiveConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
mrward committed Oct 13, 2012
1 parent e428c65 commit 07fe2e5
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
Expand Up @@ -85,5 +85,10 @@ internal IEnumerable<string> GetAllPropertyNames()
"StartupProject"
};
}

internal SolutionConfiguration GetActiveConfiguration()
{
return new SolutionConfiguration(solution.Preferences);
}
}
}
Expand Up @@ -19,7 +19,7 @@ public SolutionBuild(Solution solution)
}

public global::EnvDTE.SolutionConfiguration ActiveConfiguration {
get { throw new NotImplementedException(); }
get { return solution.GetActiveConfiguration(); }
}

/// <summary>
Expand Down
Expand Up @@ -2,17 +2,21 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)

using System;
using ICSharpCode.SharpDevelop.Project;

namespace ICSharpCode.PackageManagement.EnvDTE
{
public class SolutionConfiguration : MarshalByRefObject, global::EnvDTE.SolutionConfiguration
{
public SolutionConfiguration()
SolutionPreferences preferences;

public SolutionConfiguration(SolutionPreferences preferences)
{
this.preferences = preferences;
}

public string Name {
get { throw new NotImplementedException(); }
get { return preferences.ActiveConfiguration; }
}
}
}
Expand Up @@ -34,6 +34,11 @@ void AddStartupProject(string projectFileName)
solutionHelper.SetStartupProject(project);
}

void SetActiveConfiguration(string name)
{
solutionHelper.SetActiveConfiguration(name);
}

[Test]
public void StartupProjects_SolutionHasNoProjects_ReturnsEmptyArray()
{
Expand All @@ -56,5 +61,17 @@ public void StartupProjects_SolutionHasStartupProjectDefined_ReturnsArrayContain

CollectionAssert.AreEqual(expectedProjects, projects);
}

[Test]
public void ActiveConfiguration_SolutionHasDebugAsActiveConfig_ReturnsDebugForActiveConfigName()
{
CreateSolutionBuild();
SetActiveConfiguration("Debug");

global::EnvDTE.SolutionConfiguration config = solutionBuild.ActiveConfiguration;
string name = config.Name;

Assert.AreEqual("Debug", name);
}
}
}
Expand Up @@ -115,5 +115,10 @@ public void SetStartupProject(SD.IProject project)
{
MSBuildSolution.Preferences.StartupProject = project;
}

public void SetActiveConfiguration(string name)
{
MSBuildSolution.Preferences.ActiveConfiguration = name;
}
}
}

0 comments on commit 07fe2e5

Please sign in to comment.