@ -3,24 +3,26 @@
@@ -3,24 +3,26 @@
using System ;
using System.Collections.Generic ;
using System.Linq ;
using NuGet ;
namespace ICSharpCode.PackageManagement.Design
{
public class FakeSettings : ISettings
{
public List < KeyValuePair < string , string > > PackageSources
= new List < KeyValuePair < string , string > > ( ) ;
public List < SettingValue > PackageSources
= new List < SettingValue > ( ) ;
public List < KeyValuePair < string , string > > DisabledPackageSources
= new List < KeyValuePair < string , string > > ( ) ;
public List < SettingValue > DisabledPackageSources
= new List < SettingValue > ( ) ;
public List < KeyValuePair < string , string > > ActivePackageSourceSettings =
new List < KeyValuePair < string , string > > ( ) ;
public List < SettingValue > ActivePackageSourceSettings =
new List < SettingValue > ( ) ;
public Dictionary < string , IList < SettingValue > > Sections
= new Dictionary < string , IList < SettingValue > > ( ) ;
public Dictionary < string , IList < KeyValuePair < string , string > > > Sections
= new Dictionary < string , IList < KeyValuePair < string , string > > > ( ) ;
public FakeSettings ( )
{
Sections . Add ( RegisteredPackageSourceSettings . PackageSourcesSectionName , PackageSources ) ;
@ -28,29 +30,29 @@ namespace ICSharpCode.PackageManagement.Design
@@ -28,29 +30,29 @@ namespace ICSharpCode.PackageManagement.Design
Sections . Add ( RegisteredPackageSourceSettings . DisabledPackageSourceSectionName , DisabledPackageSources ) ;
}
public string GetValue ( string section , string key )
public string GetValue ( string section , string key , bool isPath )
{
if ( ! Sections . ContainsKey ( section ) )
return null ;
IList < KeyValuePair < string , string > > values = Sections [ section ] ;
foreach ( KeyValuePair < string , string > keyPair in values ) {
if ( keyPair . Key = = key ) {
return keyPair . Value ;
IList < SettingValue > values = Sections [ section ] ;
foreach ( SettingValue setting in values ) {
if ( setting . Key = = key ) {
return setting . Value ;
}
}
return null ;
}
public IList < KeyValuePair < string , string > > GetValues ( string section )
public IList < SettingValue > GetValues ( string section , bool isPath )
{
return Sections [ section ] ;
}
public void AddFakePackageSource ( PackageSource packageSource )
{
var valuePair = new KeyValuePair < string , string > ( packageSource . Name , packageSource . Source ) ;
PackageSources . Add ( valuePair ) ;
var setting = new SettingValue ( packageSource . Name , packageSource . Source , fals e ) ;
PackageSources . Add ( setting ) ;
}
public Dictionary < string , KeyValuePair < string , string > > SavedSectionValues =
@ -115,8 +117,8 @@ namespace ICSharpCode.PackageManagement.Design
@@ -115,8 +117,8 @@ namespace ICSharpCode.PackageManagement.Design
public void SetFakeActivePackageSource ( PackageSource packageSource )
{
ActivePackageSourceSettings . Clear ( ) ;
var valuePair = new KeyValuePair < string , string > ( packageSource . Name , packageSource . Source ) ;
ActivePackageSourceSettings . Add ( valuePair ) ;
var setting = new SettingValue ( packageSource . Name , packageSource . Source , fals e ) ;
ActivePackageSourceSettings . Add ( setting ) ;
}
public void MakeActivePackageSourceSectionNull ( )
@ -138,20 +140,20 @@ namespace ICSharpCode.PackageManagement.Design
@@ -138,20 +140,20 @@ namespace ICSharpCode.PackageManagement.Design
}
}
public IList < KeyValuePair < string , string > > GetNestedValues ( string section , string key )
public IList < SettingValue > GetNestedValues ( string section , string key )
{
throw new NotImplementedException ( ) ;
return new List < SettingValue > ( ) ;
}
public void SetNestedValues ( string section , string key , IList < KeyValuePair < string , string > > values )
public virtual v oid SetNestedValues ( string section , string key , IList < KeyValuePair < string , string > > values )
{
throw new NotImplementedException ( ) ;
}
public void AddDisabledPackageSource ( PackageSource packageSource )
{
var valuePair = new KeyValuePair < string , string > ( packageSource . Name , packageSource . Source ) ;
DisabledPackageSources . Add ( valuePair ) ;
var setting = new SettingValue ( packageSource . Name , packageSource . Source , fals e ) ;
DisabledPackageSources . Add ( setting ) ;
}
public IList < KeyValuePair < string , string > > GetValuesPassedToSetValuesForDisabledPackageSourcesSection ( )
@ -165,10 +167,10 @@ namespace ICSharpCode.PackageManagement.Design
@@ -165,10 +167,10 @@ namespace ICSharpCode.PackageManagement.Design
}
}
public void SetPackageRestoreSetting ( bool enabled )
public virtual v oid SetPackageRestoreSetting ( bool enabled )
{
var items = new List < KeyValuePair < string , string > > ( ) ;
items . Add ( new KeyValuePair < string , string > ( "enabled" , enabled . ToString ( ) ) ) ;
var items = new List < SettingValue > ( ) ;
items . Add ( new SettingValue ( "enabled" , enabled . ToString ( ) , false ) ) ;
Sections . Add ( "packageRestore" , items ) ;
}
@ -182,20 +184,5 @@ namespace ICSharpCode.PackageManagement.Design
@@ -182,20 +184,5 @@ namespace ICSharpCode.PackageManagement.Design
return SectionsDeleted . Contains ( "packageRestore" ) ;
}
}
public string GetValue ( string section , string key , bool isPath )
{
throw new NotImplementedException ( ) ;
}
public IList < KeyValuePair < string , string > > GetValues ( string section , bool isPath )
{
throw new NotImplementedException ( ) ;
}
public IList < SettingValue > GetSettingValues ( string section , bool isPath )
{
throw new NotImplementedException ( ) ;
}
}
}