Skip to content

Commit a4610e9

Browse files
committed
Fix issues with output format profiles that caused test failures
1 parent 88f5f45 commit a4610e9

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

src/CLU/Commands.Common.Authentication/Models/AzureRMProfile.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,22 @@ public void Save()
103103
/// <param name="path">File path on disk to save profile to</param>
104104
public void Save(string path)
105105
{
106+
Save(_dataStore, path);
107+
}
108+
109+
public void Save(IDataStore store, string path)
110+
{
111+
106112
if (string.IsNullOrEmpty(path))
107113
{
108114
return;
109115
}
110116

117+
if (store == null)
118+
{
119+
return;
120+
}
121+
111122
// Removing predefined environments
112123
foreach (string env in AzureEnvironment.PublicEnvironments.Keys)
113124
{
@@ -118,14 +129,14 @@ public void Save(string path)
118129
{
119130
string contents = ToString();
120131
string diskContents = string.Empty;
121-
if (_dataStore.FileExists(path))
132+
if (store.FileExists(path))
122133
{
123-
diskContents = _dataStore.ReadFileAsText(path);
134+
diskContents = store.ReadFileAsText(path);
124135
}
125136

126137
if (diskContents != contents)
127138
{
128-
_dataStore.WriteFile(path, contents);
139+
store.WriteFile(path, contents);
129140
}
130141
}
131142
finally

src/CLU/Microsoft.Azure.Commands.Profile.Test/ProfileCmdletTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public void SaveAzureProfileInMemory()
107107
profile.Environments.Add("foo", AzureEnvironment.PublicEnvironments.Values.FirstOrDefault());
108108
SaveAzureRMProfileCommand cmdlt = new SaveAzureRMProfileCommand();
109109
// Setup
110-
cmdlt.Profile = profile;
110+
cmdlt.Profile = (PSAzureProfile)profile;
111111
cmdlt.Path = "X:\\foo.json";
112112
cmdlt.DataStore = _dataStore;
113113
cmdlt.SetCommandRuntimeMock(_commandRuntimeMock);

src/CLU/Microsoft.Azure.Commands.Profile/Profile/SaveAzureRMProfile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected override void ProcessRecord()
4040
{
4141
if (Profile != null)
4242
{
43-
((AzureRMProfile)Profile).Save(Path);
43+
((AzureRMProfile) Profile).Save(DataStore, Path);
4444
}
4545
else
4646
{

src/CLU/StaticAnalysis/HelpGenerator/CmdletHelp.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public class CmdletHelp
3333
private IList<CmdletHelpReference> _references = new List<CmdletHelpReference>();
3434
private IList<Type> _output = new List<Type>();
3535
private string _noun;
36-
private string _synopsis = null;
3736
public string ClassName { get; set; }
3837
public string AssemblyName { get; set; }
3938
public string NounName

0 commit comments

Comments
 (0)