10 changed files with 677 additions and 44 deletions
@ -0,0 +1,68 @@ |
|||||||
|
// 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 System.Collections.Concurrent; |
||||||
|
using System.Collections.Generic; |
||||||
|
using ICSharpCode.Core; |
||||||
|
|
||||||
|
namespace ICSharpCode.AddInManager2.Tests.Fakes |
||||||
|
{ |
||||||
|
public class FakeAddInTree : IAddInTree |
||||||
|
{ |
||||||
|
private List<AddIn> _addIns; |
||||||
|
private ConcurrentDictionary<string, IDoozer> _doozers; |
||||||
|
private ConcurrentDictionary<string, IConditionEvaluator> _conditionEvaluators; |
||||||
|
|
||||||
|
public FakeAddInTree() |
||||||
|
{ |
||||||
|
_addIns = new List<AddIn>(); |
||||||
|
_doozers = new ConcurrentDictionary<string, IDoozer>(); |
||||||
|
_conditionEvaluators = new ConcurrentDictionary<string, IConditionEvaluator>(); |
||||||
|
} |
||||||
|
|
||||||
|
public System.Collections.Generic.IReadOnlyList<AddIn> AddIns |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _addIns.AsReadOnly(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public System.Collections.Concurrent.ConcurrentDictionary<string, IDoozer> Doozers |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _doozers; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public System.Collections.Concurrent.ConcurrentDictionary<string, IConditionEvaluator> ConditionEvaluators |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _conditionEvaluators; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public System.Collections.Generic.IReadOnlyList<T> BuildItems<T>(string path, object parameter, bool throwOnNotFound) |
||||||
|
{ |
||||||
|
return new List<T>().AsReadOnly(); |
||||||
|
} |
||||||
|
|
||||||
|
public object BuildItem(string path, object parameter) |
||||||
|
{ |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public object BuildItem(string path, object parameter, System.Collections.Generic.IEnumerable<ICondition> additionalConditions) |
||||||
|
{ |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public AddInTreeNode GetTreeNode(string path, bool throwOnNotFound) |
||||||
|
{ |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,67 @@ |
|||||||
|
// 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 System.Linq; |
||||||
|
using NuGet; |
||||||
|
|
||||||
|
namespace ICSharpCode.AddInManager2.Tests.Fakes |
||||||
|
{ |
||||||
|
public class FakeCorePackageRepository : IPackageRepository |
||||||
|
{ |
||||||
|
public FakeCorePackageRepository() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public string Source |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public bool SupportsPrereleasePackages |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public IQueryable<IPackage> ReturnedPackages |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public System.Linq.IQueryable<IPackage> GetPackages() |
||||||
|
{ |
||||||
|
return ReturnedPackages; |
||||||
|
} |
||||||
|
|
||||||
|
public void AddPackage(IPackage package) |
||||||
|
{ |
||||||
|
if (AddPackageCallback != null) |
||||||
|
{ |
||||||
|
AddPackageCallback(package); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public Action<IPackage> AddPackageCallback |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public void RemovePackage(IPackage package) |
||||||
|
{ |
||||||
|
if (RemovePackageCallback != null) |
||||||
|
{ |
||||||
|
RemovePackageCallback(package); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public Action<IPackage> RemovePackageCallback |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,174 @@ |
|||||||
|
// 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 NuGet; |
||||||
|
|
||||||
|
namespace ICSharpCode.AddInManager2.Tests.Fakes |
||||||
|
{ |
||||||
|
public class FakePackage : IPackage |
||||||
|
{ |
||||||
|
public FakePackage() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public bool IsAbsoluteLatestVersion |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public bool IsLatestVersion |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public bool Listed |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public Nullable<DateTimeOffset> Published |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public System.Collections.Generic.IEnumerable<IPackageAssemblyReference> AssemblyReferences |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public string Id |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public SemanticVersion Version |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public string Title |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public System.Collections.Generic.IEnumerable<string> Authors |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public System.Collections.Generic.IEnumerable<string> Owners |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public Uri IconUrl |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public Uri LicenseUrl |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public Uri ProjectUrl |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public bool RequireLicenseAcceptance |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public string Description |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public string Summary |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public string ReleaseNotes |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public string Language |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public string Tags |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public string Copyright |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public System.Collections.Generic.IEnumerable<FrameworkAssemblyReference> FrameworkAssemblies |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public System.Collections.Generic.IEnumerable<PackageDependencySet> DependencySets |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public Uri ReportAbuseUrl |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public int DownloadCount |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public System.Collections.Generic.IEnumerable<IPackageFile> GetFiles() |
||||||
|
{ |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public System.Collections.Generic.IEnumerable<System.Runtime.Versioning.FrameworkName> GetSupportedFrameworks() |
||||||
|
{ |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public System.IO.Stream GetStream() |
||||||
|
{ |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
// 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 System.Collections.Generic; |
||||||
|
using NuGet; |
||||||
|
|
||||||
|
namespace ICSharpCode.AddInManager2.Tests.Fakes |
||||||
|
{ |
||||||
|
public class FakePackageOperationResolver : IPackageOperationResolver |
||||||
|
{ |
||||||
|
public FakePackageOperationResolver() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public System.Collections.Generic.IEnumerable<PackageOperation> ResolveOperations(IPackage package) |
||||||
|
{ |
||||||
|
if (ResolveOperationsCallback != null) |
||||||
|
{ |
||||||
|
return ResolveOperationsCallback(package); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public Func<IPackage, IEnumerable<PackageOperation>> ResolveOperationsCallback |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,156 @@ |
|||||||
|
// 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 System.Collections.Generic; |
||||||
|
using ICSharpCode.AddInManager2.Model; |
||||||
|
using ICSharpCode.Core; |
||||||
|
|
||||||
|
namespace ICSharpCode.AddInManager2.Tests.Fakes |
||||||
|
{ |
||||||
|
public class FakeSDAddInManagement : ISDAddInManagement |
||||||
|
{ |
||||||
|
private List<AddIn> _registeredAddIns; |
||||||
|
private List<string> _addInsMarkedForRemoval; |
||||||
|
private List<AddIn> _addedExternalAddIns; |
||||||
|
private List<AddIn> _removedExternalAddIns; |
||||||
|
|
||||||
|
public FakeSDAddInManagement() |
||||||
|
{ |
||||||
|
_registeredAddIns = new List<AddIn>(); |
||||||
|
_addInsMarkedForRemoval = new List<string>(); |
||||||
|
_addedExternalAddIns = new List<AddIn>(); |
||||||
|
_removedExternalAddIns = new List<AddIn>(); |
||||||
|
} |
||||||
|
|
||||||
|
public List<AddIn> RegisteredAddIns |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _registeredAddIns; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public List<string> AddInsMarkedForRemoval |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _addInsMarkedForRemoval; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public List<AddIn> AddedExternalAddIns |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _addedExternalAddIns; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public List<AddIn> RemovedExternalAddIns |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _removedExternalAddIns; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public AddIn AddInToLoad |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public System.Collections.Generic.IReadOnlyList<ICSharpCode.Core.AddIn> AddIns |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _registeredAddIns.AsReadOnly(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string TempInstallDirectory |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public string UserInstallDirectory |
||||||
|
{ |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
public void AddToTree(ICSharpCode.Core.AddIn addIn) |
||||||
|
{ |
||||||
|
if (addIn != null) |
||||||
|
{ |
||||||
|
_registeredAddIns.Add(addIn); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void AbortRemoveUserAddInOnNextStart(string identity) |
||||||
|
{ |
||||||
|
if (identity != null) |
||||||
|
{ |
||||||
|
_addInsMarkedForRemoval.Remove(identity); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void Enable(System.Collections.Generic.IList<ICSharpCode.Core.AddIn> addIns) |
||||||
|
{ |
||||||
|
if (addIns != null) |
||||||
|
{ |
||||||
|
foreach (var addIn in addIns) |
||||||
|
{ |
||||||
|
addIn.Enabled = true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void Disable(System.Collections.Generic.IList<ICSharpCode.Core.AddIn> addIns) |
||||||
|
{ |
||||||
|
if (addIns != null) |
||||||
|
{ |
||||||
|
foreach (var addIn in addIns) |
||||||
|
{ |
||||||
|
addIn.Enabled = false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void RemoveExternalAddIns(System.Collections.Generic.IList<ICSharpCode.Core.AddIn> addIns) |
||||||
|
{ |
||||||
|
if (addIns != null) |
||||||
|
{ |
||||||
|
_removedExternalAddIns.AddRange(addIns); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void RemoveUserAddInOnNextStart(string identity) |
||||||
|
{ |
||||||
|
if (identity != null) |
||||||
|
{ |
||||||
|
_addInsMarkedForRemoval.Add(identity); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public ICSharpCode.Core.AddIn Load(System.IO.TextReader textReader) |
||||||
|
{ |
||||||
|
return AddInToLoad; |
||||||
|
} |
||||||
|
|
||||||
|
public ICSharpCode.Core.AddIn Load(string fileName) |
||||||
|
{ |
||||||
|
return AddInToLoad; |
||||||
|
} |
||||||
|
|
||||||
|
public void AddExternalAddIns(System.Collections.Generic.IList<ICSharpCode.Core.AddIn> addIns) |
||||||
|
{ |
||||||
|
if (addIns != null) |
||||||
|
{ |
||||||
|
_addedExternalAddIns.AddRange(addIns); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
<AddIn name="AddInManager Test" |
||||||
|
author ="Andreas Weizel" |
||||||
|
description="Allows to test the AddIn that allows installing and updating SharpDevelop AddIns."> |
||||||
|
|
||||||
|
<Manifest> |
||||||
|
<Identity name="ICSharpCode.AddInManager2Test" version="@ICSharpCode.AddInManager2Test.dll" /> |
||||||
|
</Manifest> |
||||||
|
|
||||||
|
<Runtime> |
||||||
|
<Import assembly="ICSharpCode.AddInManager2Test.dll"/> |
||||||
|
<Import assembly="ICSharpCode.AddInManager2.dll"/> |
||||||
|
</Runtime> |
||||||
|
</AddIn> |
Loading…
Reference in new issue