PageRenderTime 23ms CodeModel.GetById 13ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/src/AddIns/Misc/PackageManagement/Project/Src/Design/FakeRegisteredPackageRepositories.cs

https://github.com/ajadex/SharpDevelop
C# | 112 lines | 74 code | 21 blank | 17 comment | 0 complexity | c0cb9a0f1d0acf837e0484187831e2c3 MD5 | raw file
  1// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
  2// 
  3// Permission is hereby granted, free of charge, to any person obtaining a copy of this
  4// software and associated documentation files (the "Software"), to deal in the Software
  5// without restriction, including without limitation the rights to use, copy, modify, merge,
  6// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  7// to whom the Software is furnished to do so, subject to the following conditions:
  8// 
  9// The above copyright notice and this permission notice shall be included in all copies or
 10// substantial portions of the Software.
 11// 
 12// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 13// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 14// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
 15// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 16// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 17// DEALINGS IN THE SOFTWARE.
 18
 19using System;
 20using System.Collections.Generic;
 21using NuGet;
 22
 23namespace ICSharpCode.PackageManagement.Design
 24{
 25	public class FakeRegisteredPackageRepositories : IRegisteredPackageRepositories
 26	{
 27		public FakeRegisteredPackageRepositories()
 28		{
 29			PackageSources = new RegisteredPackageSources(new PackageSource[0]);
 30		}
 31		
 32		public FakePackageRepository FakeActiveRepository = new FakePackageRepository();
 33		
 34		public virtual IPackageRepository ActiveRepository {
 35			get { return FakeActiveRepository; }
 36		}
 37		
 38		public FakePackageRepository FakeRecentPackageRepository = new FakePackageRepository();
 39		
 40		public virtual IRecentPackageRepository RecentPackageRepository {
 41			get { return FakeRecentPackageRepository; }
 42		}
 43		
 44		public bool HasMultiplePackageSources { get; set; }
 45		
 46		public PackageSource ActivePackageSource { get; set; }
 47		
 48		public RegisteredPackageSources PackageSources { get; set; }
 49		
 50		public FakePackageRepository FakePackageRepository = new FakePackageRepository();
 51		public PackageSource PackageSourcePassedToCreateRepository;
 52		
 53		public IPackageRepository CreateRepository(PackageSource source)
 54		{
 55			PackageSourcePassedToCreateRepository = source;
 56			return FakePackageRepository;
 57		}
 58		
 59		public FakePackageRepository FakeAggregateRepository = new FakePackageRepository();
 60		
 61		public IPackageRepository CreateAggregateRepository()
 62		{
 63			return FakeAggregateRepository;
 64		}
 65		
 66		public void ClearPackageSources()
 67		{
 68			PackageSources.Clear();
 69		}
 70		
 71		public PackageSource AddOnePackageSource()
 72		{
 73			return AddOnePackageSource("Test");
 74		}
 75		
 76		public PackageSource AddOnePackageSource(string name)
 77		{
 78			var source = new PackageSource("http://sharpdevelop.codeplex.com", name);
 79			PackageSources.Add(source);
 80			return source;
 81		}
 82		
 83		public void AddPackageSources(IEnumerable<PackageSource> sources)
 84		{
 85			PackageSources.AddRange(sources);
 86		}
 87		
 88		public FakePackage AddFakePackageWithVersionToActiveRepository(string version)
 89		{
 90			return AddFakePackageWithVersionToActiveRepository("Test", version);
 91		}
 92		
 93		public FakePackage AddFakePackageWithVersionToActiveRepository(string id, string version)
 94		{
 95			var package = FakePackage.CreatePackageWithVersion(id, version);
 96			FakeActiveRepository.FakePackages.Add(package);
 97			return package;
 98		}
 99		
100		public FakePackage AddFakePackageWithVersionToAggregrateRepository(string id, string version)
101		{
102			var package = FakePackage.CreatePackageWithVersion(id, version);
103			FakeAggregateRepository.FakePackages.Add(package);
104			return package;
105		}
106		
107		public void UpdatePackageSources(IEnumerable<PackageSource> updatedPackageSources)
108		{
109			throw new NotImplementedException();
110		}
111	}
112}