39 changed files with 384 additions and 1150 deletions
Binary file not shown.
Binary file not shown.
@ -1,225 +0,0 @@
@@ -1,225 +0,0 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: trubra |
||||
* Date: 2014-01-28 |
||||
* Time: 10:09 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.ComponentModel; |
||||
using System.Windows; |
||||
using System.Linq; |
||||
using ICSharpCode.WpfDesign.Designer.Xaml; |
||||
using ICSharpCode.WpfDesign.XamlDom; |
||||
|
||||
namespace ICSharpCode.WpfDesign.Designer.OutlineView |
||||
{ |
||||
/// <summary>
|
||||
/// Description of OutlineNodeBase.
|
||||
/// </summary>
|
||||
public abstract class OutlineNodeBase : INotifyPropertyChanged, IOutlineNode |
||||
{ |
||||
|
||||
protected abstract void UpdateChildren(); |
||||
//Used to check if element can enter other containers
|
||||
protected static PlacementType DummyPlacementType; |
||||
|
||||
protected OutlineNodeBase(DesignItem designItem) |
||||
{ |
||||
DesignItem = designItem; |
||||
|
||||
|
||||
var hidden = designItem.Properties.GetAttachedProperty(DesignTimeProperties.IsHiddenProperty).ValueOnInstance; |
||||
if (hidden != null && (bool)hidden) { |
||||
_isDesignTimeVisible = false; |
||||
((FrameworkElement)DesignItem.Component).Visibility = Visibility.Hidden; |
||||
} |
||||
|
||||
var locked = designItem.Properties.GetAttachedProperty(DesignTimeProperties.IsLockedProperty).ValueOnInstance; |
||||
if (locked != null && (bool)locked) { |
||||
_isDesignTimeLocked = true; |
||||
} |
||||
|
||||
//TODO
|
||||
|
||||
DesignItem.NameChanged += new EventHandler(DesignItem_NameChanged); |
||||
DesignItem.PropertyChanged += new PropertyChangedEventHandler(DesignItem_PropertyChanged); |
||||
} |
||||
|
||||
public DesignItem DesignItem { get; set; } |
||||
|
||||
public ISelectionService SelectionService |
||||
{ |
||||
get { return DesignItem.Services.Selection; } |
||||
} |
||||
|
||||
bool isExpanded = true; |
||||
|
||||
public bool IsExpanded |
||||
{ |
||||
get |
||||
{ |
||||
return isExpanded; |
||||
} |
||||
set |
||||
{ |
||||
isExpanded = value; |
||||
RaisePropertyChanged("IsExpanded"); |
||||
} |
||||
} |
||||
|
||||
bool isSelected; |
||||
|
||||
public bool IsSelected |
||||
{ |
||||
get |
||||
{ |
||||
return isSelected; |
||||
} |
||||
set |
||||
{ |
||||
if (isSelected != value) { |
||||
isSelected = value; |
||||
SelectionService.SetSelectedComponents(new[] { DesignItem }, |
||||
value ? SelectionTypes.Add : SelectionTypes.Remove); |
||||
RaisePropertyChanged("IsSelected"); |
||||
} |
||||
} |
||||
} |
||||
|
||||
bool _isDesignTimeVisible = true; |
||||
|
||||
public bool IsDesignTimeVisible |
||||
{ |
||||
get |
||||
{ |
||||
return _isDesignTimeVisible; |
||||
} |
||||
set |
||||
{ |
||||
_isDesignTimeVisible = value; |
||||
var ctl = DesignItem.Component as UIElement; |
||||
if(ctl!=null) |
||||
ctl.Visibility = _isDesignTimeVisible ? Visibility.Visible : Visibility.Hidden; |
||||
|
||||
RaisePropertyChanged("IsDesignTimeVisible"); |
||||
|
||||
if (!value) |
||||
DesignItem.Properties.GetAttachedProperty(DesignTimeProperties.IsHiddenProperty).SetValue(true); |
||||
else |
||||
DesignItem.Properties.GetAttachedProperty(DesignTimeProperties.IsHiddenProperty).Reset(); |
||||
} |
||||
} |
||||
|
||||
bool _isDesignTimeLocked = false; |
||||
|
||||
public bool IsDesignTimeLocked |
||||
{ |
||||
get |
||||
{ |
||||
return _isDesignTimeLocked; |
||||
} |
||||
set |
||||
{ |
||||
_isDesignTimeLocked = value; |
||||
((XamlDesignItem)DesignItem).IsDesignTimeLocked = _isDesignTimeLocked; |
||||
|
||||
RaisePropertyChanged("IsDesignTimeLocked"); |
||||
|
||||
// if (value)
|
||||
// DesignItem.Properties.GetAttachedProperty(DesignTimeProperties.IsLockedProperty).SetValue(true);
|
||||
// else
|
||||
// DesignItem.Properties.GetAttachedProperty(DesignTimeProperties.IsLockedProperty).Reset();
|
||||
} |
||||
} |
||||
|
||||
ObservableCollection<IOutlineNode> children = new ObservableCollection<IOutlineNode>(); |
||||
|
||||
public ObservableCollection<IOutlineNode> Children |
||||
{ |
||||
get { return children; } |
||||
} |
||||
|
||||
public string Name |
||||
{ |
||||
get |
||||
{ |
||||
if (string.IsNullOrEmpty(DesignItem.Name)) { |
||||
return DesignItem.ComponentType.Name; |
||||
} |
||||
return DesignItem.ComponentType.Name + " (" + DesignItem.Name + ")"; |
||||
} |
||||
} |
||||
|
||||
void DesignItem_NameChanged(object sender, EventArgs e) |
||||
{ |
||||
RaisePropertyChanged("Name"); |
||||
} |
||||
|
||||
void DesignItem_PropertyChanged(object sender, PropertyChangedEventArgs e) |
||||
{ |
||||
if (e.PropertyName == DesignItem.ContentPropertyName) { |
||||
UpdateChildren(); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
public bool CanInsert(IEnumerable<IOutlineNode> nodes, IOutlineNode after, bool copy) |
||||
{ |
||||
var placementBehavior = DesignItem.GetBehavior<IPlacementBehavior>(); |
||||
if (placementBehavior == null) |
||||
return false; |
||||
var operation = PlacementOperation.Start(nodes.Select(node => node.DesignItem).ToArray(), DummyPlacementType); |
||||
if (operation != null) { |
||||
bool canEnter = placementBehavior.CanEnterContainer(operation, true); |
||||
operation.Abort(); |
||||
return canEnter; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
public virtual void Insert(IEnumerable<IOutlineNode> nodes, IOutlineNode after, bool copy) |
||||
{ |
||||
using (var moveTransaction = DesignItem.Context.OpenGroup("Item moved in outline view", nodes.Select(n => n.DesignItem).ToList())) |
||||
{ |
||||
if (copy) { |
||||
nodes = nodes.Select(n => OutlineNode.Create(n.DesignItem.Clone())).ToList(); |
||||
} else { |
||||
foreach (var node in nodes) { |
||||
node.DesignItem.Remove(); |
||||
} |
||||
} |
||||
|
||||
var index = after == null ? 0 : Children.IndexOf(after) + 1; |
||||
|
||||
var content = DesignItem.ContentProperty; |
||||
if (content.IsCollection) { |
||||
foreach (var node in nodes) { |
||||
content.CollectionElements.Insert(index++, node.DesignItem); |
||||
} |
||||
} else { |
||||
content.SetValue(nodes.First().DesignItem); |
||||
} |
||||
moveTransaction.Commit(); |
||||
} |
||||
} |
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
public void RaisePropertyChanged(string name) |
||||
{ |
||||
if (PropertyChanged != null) |
||||
{ |
||||
PropertyChanged(this, new PropertyChangedEventArgs(name)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
@ -1,94 +1,94 @@
@@ -1,94 +1,94 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{88DA149F-21B2-48AB-82C4-28FB6BDFD783}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>ICSharpCode.WpfDesign.XamlDom</RootNamespace> |
||||
<AssemblyName>ICSharpCode.WpfDesign.XamlDom</AssemblyName> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
<SignAssembly>True</SignAssembly> |
||||
<AssemblyOriginatorKeyFile>..\..\..\..\..\Main\ICSharpCode.SharpDevelop.snk</AssemblyOriginatorKeyFile> |
||||
<DelaySign>False</DelaySign> |
||||
<AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode> |
||||
<RunCodeAnalysis>False</RunCodeAnalysis> |
||||
<CodeAnalysisRules>-Microsoft.Globalization#CA1303;-Microsoft.Performance#CA1800</CodeAnalysisRules> |
||||
<OutputPath>..\..\..\..\..\..\AddIns\DisplayBindings\WpfDesign\</OutputPath> |
||||
<DocumentationFile>..\..\..\..\..\..\AddIns\DisplayBindings\WpfDesign\ICSharpCode.WpfDesign.XamlDom.xml</DocumentationFile> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<SourceAnalysisOverrideSettingsFile>C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile> |
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<Optimize>False</Optimize> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
<ItemGroup> |
||||
<Reference Include="PresentationCore"> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="PresentationFramework"> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="System.Xaml" /> |
||||
<Reference Include="WindowsBase"> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="..\..\..\..\..\Main\GlobalAssemblyInfo.cs"> |
||||
<Link>GlobalAssemblyInfo.cs</Link> |
||||
</Compile> |
||||
<Compile Include="AssemblyInfo.cs" /> |
||||
<Compile Include="CollectionElementsCollection.cs" /> |
||||
<Compile Include="CollectionSupport.cs" /> |
||||
<Compile Include="DesignTimeProperties.cs" /> |
||||
<Compile Include="IXamlErrorSink.cs" /> |
||||
<Compile Include="MarkupCompatibilityProperties.cs" /> |
||||
<Compile Include="MarkupExtensionParser.cs" /> |
||||
<Compile Include="MarkupExtensionPrinter.cs" /> |
||||
<Compile Include="NameScopeHelper.cs" /> |
||||
<Compile Include="PositionXmlDocument.cs" /> |
||||
<Compile Include="XamlConstants.cs" /> |
||||
<Compile Include="XamlDocument.cs" /> |
||||
<Compile Include="XamlLoadException.cs" /> |
||||
<Compile Include="XamlObject.cs" /> |
||||
<Compile Include="XamlObjectServiceProvider.cs" /> |
||||
<Compile Include="XamlParser.cs" /> |
||||
<Compile Include="XamlParserSettings.cs" /> |
||||
<Compile Include="XamlProperty.cs" /> |
||||
<Compile Include="XamlPropertyInfo.cs" /> |
||||
<Compile Include="XamlPropertyValue.cs" /> |
||||
<Compile Include="XamlStaticTools.cs" /> |
||||
<Compile Include="XamlTextValue.cs" /> |
||||
<Compile Include="XamlTypeFinder.cs" /> |
||||
<Compile Include="XamlTypeResolverProvider.cs" /> |
||||
</ItemGroup> |
||||
</Project> |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{88DA149F-21B2-48AB-82C4-28FB6BDFD783}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>ICSharpCode.WpfDesign.XamlDom</RootNamespace> |
||||
<AssemblyName>ICSharpCode.WpfDesign.XamlDom</AssemblyName> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
<SignAssembly>True</SignAssembly> |
||||
<AssemblyOriginatorKeyFile>..\..\..\..\..\Main\ICSharpCode.SharpDevelop.snk</AssemblyOriginatorKeyFile> |
||||
<DelaySign>False</DelaySign> |
||||
<AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode> |
||||
<RunCodeAnalysis>False</RunCodeAnalysis> |
||||
<CodeAnalysisRules>-Microsoft.Globalization#CA1303;-Microsoft.Performance#CA1800</CodeAnalysisRules> |
||||
<OutputPath>..\..\..\..\..\..\AddIns\DisplayBindings\WpfDesign\</OutputPath> |
||||
<DocumentationFile>..\..\..\..\..\..\AddIns\DisplayBindings\WpfDesign\ICSharpCode.WpfDesign.XamlDom.xml</DocumentationFile> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<SourceAnalysisOverrideSettingsFile>C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile> |
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<Optimize>False</Optimize> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
<ItemGroup> |
||||
<Reference Include="PresentationCore"> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="PresentationFramework"> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="System.Xaml" /> |
||||
<Reference Include="WindowsBase"> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="..\..\..\..\..\Main\GlobalAssemblyInfo.cs"> |
||||
<Link>GlobalAssemblyInfo.cs</Link> |
||||
</Compile> |
||||
<Compile Include="AssemblyInfo.cs" /> |
||||
<Compile Include="CollectionElementsCollection.cs" /> |
||||
<Compile Include="CollectionSupport.cs" /> |
||||
<Compile Include="DesignTimeProperties.cs" /> |
||||
<Compile Include="IXamlErrorSink.cs" /> |
||||
<Compile Include="MarkupCompatibilityProperties.cs" /> |
||||
<Compile Include="MarkupExtensionParser.cs" /> |
||||
<Compile Include="MarkupExtensionPrinter.cs" /> |
||||
<Compile Include="NameScopeHelper.cs" /> |
||||
<Compile Include="PositionXmlDocument.cs" /> |
||||
<Compile Include="XamlConstants.cs" /> |
||||
<Compile Include="XamlDocument.cs" /> |
||||
<Compile Include="XamlLoadException.cs" /> |
||||
<Compile Include="XamlObject.cs" /> |
||||
<Compile Include="XamlObjectServiceProvider.cs" /> |
||||
<Compile Include="XamlParser.cs" /> |
||||
<Compile Include="XamlParserSettings.cs" /> |
||||
<Compile Include="XamlProperty.cs" /> |
||||
<Compile Include="XamlPropertyInfo.cs" /> |
||||
<Compile Include="XamlPropertyValue.cs" /> |
||||
<Compile Include="XamlStaticTools.cs" /> |
||||
<Compile Include="XamlTextValue.cs" /> |
||||
<Compile Include="XamlTypeFinder.cs" /> |
||||
<Compile Include="XamlTypeResolverProvider.cs" /> |
||||
</ItemGroup> |
||||
</Project> |
||||
|
@ -1,79 +0,0 @@
@@ -1,79 +0,0 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using NuGet; |
||||
|
||||
namespace ICSharpCode.PackageManagement |
||||
{ |
||||
public class InstalledPackageViewModel : PackageViewModel |
||||
{ |
||||
public InstalledPackageViewModel( |
||||
IPackageViewModelParent parent, |
||||
IPackageFromRepository package, |
||||
SelectedProjectsForInstalledPackages selectedProjects, |
||||
IPackageManagementEvents packageManagementEvents, |
||||
IPackageActionRunner actionRunner, |
||||
ILogger logger) |
||||
: base(parent, package, selectedProjects, packageManagementEvents, actionRunner, logger) |
||||
{ |
||||
} |
||||
|
||||
public override IList<ProcessPackageAction> GetProcessPackageActionsForSelectedProjects( |
||||
IList<IPackageManagementSelectedProject> selectedProjects) |
||||
{ |
||||
var actions = new List<ProcessPackageAction>(); |
||||
foreach (IPackageManagementSelectedProject selectedProject in selectedProjects) { |
||||
ProcessPackageAction action = CreatePackageAction(selectedProject); |
||||
if (action != null) { |
||||
actions.Add(action); |
||||
} |
||||
} |
||||
return actions; |
||||
} |
||||
|
||||
ProcessPackageAction CreatePackageAction(IPackageManagementSelectedProject selectedProject) |
||||
{ |
||||
if (selectedProject.IsSelected) { |
||||
return base.CreateInstallPackageAction(selectedProject); |
||||
} |
||||
return CreateUninstallPackageActionForSelectedProject(selectedProject); |
||||
} |
||||
|
||||
ProcessPackageAction CreateUninstallPackageActionForSelectedProject(IPackageManagementSelectedProject selectedProject) |
||||
{ |
||||
ProcessPackageAction action = base.CreateUninstallPackageAction(selectedProject); |
||||
if (IsPackageInstalled(action.Project)) { |
||||
return action; |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
bool IsPackageInstalled(IPackageManagementProject project) |
||||
{ |
||||
IPackage package = GetPackage(); |
||||
return project.IsPackageInstalled(package); |
||||
} |
||||
|
||||
protected override bool AnyProjectsSelected(IList<IPackageManagementSelectedProject> projects) |
||||
{ |
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -1,89 +0,0 @@
@@ -1,89 +0,0 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using NuGet; |
||||
|
||||
namespace ICSharpCode.PackageManagement |
||||
{ |
||||
/// <summary>
|
||||
/// Supports a configurable set of package repositories for project templates that can be
|
||||
/// different to the registered package repositories used with the Add Package Reference dialog.
|
||||
/// </summary>
|
||||
public class ProjectTemplatePackageRepositoryCache : IPackageRepositoryCache |
||||
{ |
||||
IPackageRepositoryCache packageRepositoryCache; |
||||
RegisteredProjectTemplatePackageSources registeredPackageSources; |
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the ProjectTemplatePackageRepositoryCache.
|
||||
/// </summary>
|
||||
/// <param name="packageRepositoryCache">The main package repository cache used
|
||||
/// with the Add Package Reference dialog.</param>
|
||||
public ProjectTemplatePackageRepositoryCache( |
||||
IPackageRepositoryCache packageRepositoryCache, |
||||
RegisteredProjectTemplatePackageSources registeredPackageSources) |
||||
{ |
||||
this.packageRepositoryCache = packageRepositoryCache; |
||||
this.registeredPackageSources = registeredPackageSources; |
||||
} |
||||
|
||||
public IRecentPackageRepository RecentPackageRepository { |
||||
get { throw new NotImplementedException(); } |
||||
} |
||||
|
||||
public IPackageRepository CreateAggregateRepository() |
||||
{ |
||||
IEnumerable<IPackageRepository> repositories = GetRegisteredPackageRepositories(); |
||||
return CreateAggregateRepository(repositories); |
||||
} |
||||
|
||||
IEnumerable<IPackageRepository> GetRegisteredPackageRepositories() |
||||
{ |
||||
foreach (PackageSource packageSource in GetEnabledPackageSources()) { |
||||
yield return CreateRepository(packageSource.Source); |
||||
} |
||||
} |
||||
|
||||
public IEnumerable<PackageSource> GetEnabledPackageSources() |
||||
{ |
||||
return registeredPackageSources.PackageSources.GetEnabledPackageSources(); |
||||
} |
||||
|
||||
public ISharedPackageRepository CreateSharedRepository(IPackagePathResolver pathResolver, IFileSystem fileSystem, IFileSystem configSettingsFileSystem) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public IRecentPackageRepository CreateRecentPackageRepository(IList<RecentPackageInfo> recentPackages, IPackageRepository aggregateRepository) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public IPackageRepository CreateAggregateRepository(IEnumerable<IPackageRepository> repositories) |
||||
{ |
||||
return packageRepositoryCache.CreateAggregateRepository(repositories); |
||||
} |
||||
|
||||
public IPackageRepository CreateRepository(string packageSource) |
||||
{ |
||||
return packageRepositoryCache.CreateRepository(packageSource); |
||||
} |
||||
} |
||||
} |
@ -1,64 +0,0 @@
@@ -1,64 +0,0 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using NuGet; |
||||
|
||||
namespace ICSharpCode.PackageManagement |
||||
{ |
||||
public class RegisteredProjectTemplatePackageSources |
||||
{ |
||||
RegisteredPackageSourceSettings registeredPackageSourceSettings; |
||||
|
||||
public RegisteredProjectTemplatePackageSources() |
||||
: this(new PackageManagementPropertyService(), new SettingsFactory()) |
||||
{ |
||||
} |
||||
|
||||
public RegisteredProjectTemplatePackageSources( |
||||
IPropertyService propertyService, |
||||
ISettingsFactory settingsFactory) |
||||
{ |
||||
GetRegisteredPackageSources(propertyService, settingsFactory); |
||||
} |
||||
|
||||
void GetRegisteredPackageSources(IPropertyService propertyService, ISettingsFactory settingsFactory) |
||||
{ |
||||
ISettings settings = CreateSettings(propertyService, settingsFactory); |
||||
PackageSource defaultPackageSource = CreateDefaultPackageSource(propertyService); |
||||
registeredPackageSourceSettings = new RegisteredPackageSourceSettings(settings, defaultPackageSource); |
||||
} |
||||
|
||||
ISettings CreateSettings(IPropertyService propertyService, ISettingsFactory settingsFactory) |
||||
{ |
||||
var settingsFileName = new ProjectTemplatePackagesSettingsFileName(propertyService); |
||||
return settingsFactory.CreateSettings(settingsFileName.Directory); |
||||
} |
||||
|
||||
PackageSource CreateDefaultPackageSource(IPropertyService propertyService) |
||||
{ |
||||
var defaultPackageSource = new DefaultProjectTemplatePackageSource(propertyService); |
||||
return defaultPackageSource.PackageSource; |
||||
} |
||||
|
||||
public RegisteredPackageSources PackageSources { |
||||
get { return registeredPackageSourceSettings.PackageSources; } |
||||
} |
||||
} |
||||
} |
@ -1,26 +0,0 @@
@@ -1,26 +0,0 @@
|
||||
<gui:OptionPanel |
||||
x:Class="ICSharpCode.PackageManagement.RegisteredProjectTemplatePackageSourcesView" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
||||
xmlns:pm="clr-namespace:ICSharpCode.PackageManagement" |
||||
xmlns:pmd="clr-namespace:ICSharpCode.PackageManagement.Design" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
mc:Ignorable="d" |
||||
d:DesignHeight="300" |
||||
d:DesignWidth="300" |
||||
Height="300"> |
||||
|
||||
<Grid x:Name="MainGrid"> |
||||
<Grid.Resources> |
||||
<pm:PackageManagementViewModels x:Key="ViewModels"/> |
||||
</Grid.Resources> |
||||
|
||||
<Grid.DataContext> |
||||
<Binding Source="{StaticResource ViewModels}" Path="RegisteredProjectTemplatePackageSourcesViewModel"/> |
||||
</Grid.DataContext> |
||||
|
||||
<pm:RegisteredPackageSourcesUserControl/> |
||||
</Grid> |
||||
</gui:OptionPanel> |
@ -1,88 +0,0 @@
@@ -1,88 +0,0 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using ICSharpCode.NRefactory.Ast;
|
||||
//using ICSharpCode.SharpDevelop.Dom.Refactoring;
|
||||
//using NUnit.Framework;
|
||||
//
|
||||
//namespace PackageManagement.Tests
|
||||
//{
|
||||
// [TestFixture]
|
||||
// public class CodeGeneratorTests
|
||||
// {
|
||||
// CSharpCodeGenerator codeGenerator;
|
||||
//
|
||||
// void CreateCodeGenerator()
|
||||
// {
|
||||
// codeGenerator = new CSharpCodeGenerator();
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GenerateCode_Field_CreatesField()
|
||||
// {
|
||||
// CreateCodeGenerator();
|
||||
// var field = new FieldDeclaration(new List<AttributeSection>());
|
||||
// field.TypeReference = new TypeReference("MyClass");
|
||||
// field.Modifier = Modifiers.Public;
|
||||
// field.Fields.Add(new VariableDeclaration("myField"));
|
||||
//
|
||||
// string code = codeGenerator.GenerateCode(field, String.Empty);
|
||||
//
|
||||
// string expectedCode = "public MyClass myField;\r\n";
|
||||
//
|
||||
// Assert.AreEqual(expectedCode, code);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GenerateCode_Method_CreatesMethod()
|
||||
// {
|
||||
// CreateCodeGenerator();
|
||||
// var method = new MethodDeclaration();
|
||||
// method.Name = "MyMethod";
|
||||
// method.TypeReference = new TypeReference("MyReturnType");
|
||||
// method.Modifier = Modifiers.Public;
|
||||
// method.Body = new BlockStatement();
|
||||
//
|
||||
// string code = codeGenerator.GenerateCode(method, String.Empty);
|
||||
//
|
||||
// string expectedCode =
|
||||
// "public MyReturnType MyMethod()\r\n" +
|
||||
// "{\r\n" +
|
||||
// "}\r\n";
|
||||
//
|
||||
// Assert.AreEqual(expectedCode, code);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GenerateCode_InterfaceMethodDeclaration_CreatesMethod()
|
||||
// {
|
||||
// CreateCodeGenerator();
|
||||
// var method = new MethodDeclaration();
|
||||
// method.Name = "MyMethod";
|
||||
// method.TypeReference = new TypeReference("MyReturnType");
|
||||
//
|
||||
// string code = codeGenerator.GenerateCode(method, String.Empty);
|
||||
//
|
||||
// string expectedCode = "MyReturnType MyMethod();\r\n";
|
||||
//
|
||||
// Assert.AreEqual(expectedCode, code);
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,120 +0,0 @@
@@ -1,120 +0,0 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.PackageManagement; |
||||
using ICSharpCode.PackageManagement.Design; |
||||
using NuGet; |
||||
using NUnit.Framework; |
||||
using PackageManagement.Tests.Helpers; |
||||
|
||||
namespace PackageManagement.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class ProjectTemplatePackageRepositoryCacheTests |
||||
{ |
||||
ProjectTemplatePackageRepositoryCache cache; |
||||
FakePackageRepositoryFactory fakeMainCache; |
||||
RegisteredProjectTemplatePackageSources registeredPackageSources; |
||||
FakeSettingsFactory fakeSettingsFactory; |
||||
|
||||
void CreateCache() |
||||
{ |
||||
fakeMainCache = new FakePackageRepositoryFactory(); |
||||
var propertyService = new FakePropertyService(); |
||||
fakeSettingsFactory = new FakeSettingsFactory(); |
||||
registeredPackageSources = new RegisteredProjectTemplatePackageSources(propertyService, fakeSettingsFactory); |
||||
cache = new ProjectTemplatePackageRepositoryCache(fakeMainCache, registeredPackageSources); |
||||
} |
||||
|
||||
void ClearRegisteredPackageSources() |
||||
{ |
||||
registeredPackageSources.PackageSources.Clear(); |
||||
} |
||||
|
||||
void AddRegisteredPackageSource(PackageSource packageSource) |
||||
{ |
||||
registeredPackageSources.PackageSources.Add(packageSource); |
||||
} |
||||
|
||||
void AddRegisteredPackageSource(string url, string name) |
||||
{ |
||||
var packageSource = new PackageSource(url, name); |
||||
AddRegisteredPackageSource(packageSource); |
||||
} |
||||
|
||||
FakePackageRepository AddRegisteredPackageRepository(string packageSourceUrl, string packageSourceName) |
||||
{ |
||||
var packageSource = new PackageSource(packageSourceUrl, packageSourceName); |
||||
AddRegisteredPackageSource(packageSource); |
||||
FakePackageRepository fakeRepository = new FakePackageRepository(); |
||||
fakeMainCache.FakePackageRepositories.Add(packageSource.Source, fakeRepository); |
||||
return fakeRepository; |
||||
} |
||||
|
||||
[Test] |
||||
public void CreateAggregateRepository_OneRegisteredPackageSource_CreatesAggregrateRepositoryUsingMainCache() |
||||
{ |
||||
CreateCache(); |
||||
ClearRegisteredPackageSources(); |
||||
AddRegisteredPackageSource("http://sharpdevelop.com", "Test"); |
||||
|
||||
IPackageRepository repository = cache.CreateAggregateRepository(); |
||||
|
||||
IPackageRepository expectedRepository = fakeMainCache.FakeAggregateRepository; |
||||
Assert.AreEqual(expectedRepository, repository); |
||||
} |
||||
|
||||
[Test] |
||||
public void CreateAggregateRepository_TwoRegisteredPackageSources_CreatesRepositoriesForRegisteredPackageSources() |
||||
{ |
||||
CreateCache(); |
||||
ClearRegisteredPackageSources(); |
||||
FakePackageRepository fakeRepository1 = AddRegisteredPackageRepository("http://sharpdevelop.com", "Test"); |
||||
FakePackageRepository fakeRepository2 = AddRegisteredPackageRepository("http://test", "Test2"); |
||||
|
||||
IPackageRepository repository = cache.CreateAggregateRepository(); |
||||
|
||||
IEnumerable<IPackageRepository> repositories = fakeMainCache.RepositoriesPassedToCreateAggregateRepository; |
||||
var expectedRepositories = new List<IPackageRepository>(); |
||||
expectedRepositories.Add(fakeRepository1); |
||||
expectedRepositories.Add(fakeRepository2); |
||||
|
||||
Assert.AreEqual(expectedRepositories, repositories); |
||||
} |
||||
|
||||
[Test] |
||||
public void CreateAggregatePackageRepository_TwoRegisteredPackageSourcesButOneDisabled_ReturnsAggregateRepositoryCreatedWithOnlyEnabledPackageSource() |
||||
{ |
||||
CreateCache(); |
||||
ClearRegisteredPackageSources(); |
||||
FakePackageRepository fakeRepository1 = AddRegisteredPackageRepository("http://sharpdevelop.com", "Test"); |
||||
FakePackageRepository fakeRepository2 = AddRegisteredPackageRepository("http://test", "Test2"); |
||||
registeredPackageSources.PackageSources[0].IsEnabled = false; |
||||
|
||||
IPackageRepository repository = cache.CreateAggregateRepository(); |
||||
|
||||
IEnumerable<IPackageRepository> repositories = fakeMainCache.RepositoriesPassedToCreateAggregateRepository; |
||||
var expectedRepositories = new List<IPackageRepository>(); |
||||
expectedRepositories.Add(fakeRepository2); |
||||
|
||||
Assert.AreEqual(expectedRepositories, repositories); |
||||
} |
||||
} |
||||
} |
@ -1,103 +0,0 @@
@@ -1,103 +0,0 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.PackageManagement; |
||||
using ICSharpCode.PackageManagement.Design; |
||||
using NuGet; |
||||
using NUnit.Framework; |
||||
using PackageManagement.Tests.Helpers; |
||||
|
||||
namespace PackageManagement.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class RegisteredProjectTemplatePackageSourcesTests |
||||
{ |
||||
RegisteredProjectTemplatePackageSources registeredPackageSources; |
||||
FakeSettingsFactory fakeSettingsFactory; |
||||
|
||||
FakePropertyService CreatePropertyService() |
||||
{ |
||||
return new FakePropertyService(); |
||||
} |
||||
|
||||
void CreateRegisteredPackageSources(List<PackageSource> packageSources, FakePropertyService propertyService) |
||||
{ |
||||
fakeSettingsFactory = new FakeSettingsFactory(); |
||||
fakeSettingsFactory.FakeSettings.AddFakePackageSources(packageSources); |
||||
registeredPackageSources = |
||||
new RegisteredProjectTemplatePackageSources( |
||||
propertyService, |
||||
fakeSettingsFactory); |
||||
} |
||||
|
||||
[Test] |
||||
public void PackageSources_NoPredefinedPackageSources_DefaultPackageSourceCreated() |
||||
{ |
||||
FakePropertyService propertyService = CreatePropertyService(); |
||||
propertyService.DataDirectory = @"d:\sharpdevelop\data"; |
||||
|
||||
var packageSources = new List<PackageSource>(); |
||||
CreateRegisteredPackageSources(packageSources, propertyService); |
||||
|
||||
RegisteredPackageSources actualPackageSources = |
||||
registeredPackageSources.PackageSources; |
||||
|
||||
var expectedPackageSources = new PackageSource[] { |
||||
new PackageSource(@"d:\sharpdevelop\data\templates\packages", "Default") |
||||
}; |
||||
|
||||
PackageSourceCollectionAssert.AreEqual(expectedPackageSources, actualPackageSources); |
||||
} |
||||
|
||||
[Test] |
||||
public void PackageSources_OnePredefinedPackageSource_RegisteredPackageSourceIsPredefinedPackageSource() |
||||
{ |
||||
FakePropertyService propertyService = CreatePropertyService(); |
||||
propertyService.DataDirectory = @"d:\sharpdevelop\data"; |
||||
var expectedPackageSources = new List<PackageSource>(); |
||||
expectedPackageSources.Add(new PackageSource("http://sharpdevelop", "Test")); |
||||
CreateRegisteredPackageSources(expectedPackageSources, propertyService); |
||||
|
||||
RegisteredPackageSources actualPackageSources = |
||||
registeredPackageSources.PackageSources; |
||||
|
||||
PackageSourceCollectionAssert.AreEqual(expectedPackageSources, actualPackageSources); |
||||
} |
||||
|
||||
[Test] |
||||
public void PackageSources_NoPredefinedPackageSources_PackageSourceConfigLookedForInUserFolder() |
||||
{ |
||||
FakePropertyService propertyService = CreatePropertyService(); |
||||
propertyService.DataDirectory = @"d:\sharpdevelop\data"; |
||||
propertyService.ConfigDirectory = @"c:\Users\test\AppData\ICSharpCode\SharpDevelop4.1"; |
||||
|
||||
var packageSources = new List<PackageSource>(); |
||||
CreateRegisteredPackageSources(packageSources, propertyService); |
||||
|
||||
IEnumerable<PackageSource> actualPackageSources = |
||||
registeredPackageSources.PackageSources; |
||||
|
||||
string directory = fakeSettingsFactory.DirectoryPassedToCreateSettings; |
||||
string expectedDirectory = @"c:\Users\test\AppData\ICSharpCode\SharpDevelop4.1\templates"; |
||||
|
||||
Assert.AreEqual(expectedDirectory, directory); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue