Skip to content

Commit 7b52116

Browse files
committed
Addressed PR comments
1. Removed mstest tests 2. Move exception string to resource 3. Remove an else
1 parent a4fa899 commit 7b52116

File tree

5 files changed

+18
-49
lines changed

5 files changed

+18
-49
lines changed

src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationRunbookTest.cs

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
using Microsoft.Azure.Commands.Automation.Cmdlet;
1616
using Microsoft.Azure.Commands.Automation.Common;
17-
using Microsoft.Azure.Management.Automation.Models;
1817
using Microsoft.VisualStudio.TestTools.UnitTesting;
1918
using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
2019
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
@@ -70,47 +69,5 @@ public void NewAzureAutomationRunbookByNameSuccessful()
7069
// Assert
7170
this.mockAutomationClient.Verify(f => f.CreateRunbookByName(resourceGroupName, accountName, runbookName, description, tags, null, null, null, false), Times.Once());
7271
}
73-
74-
[TestMethod]
75-
public void NewAzureAutomationRunbookTypeValueDifferentFromSdk()
76-
{
77-
string resourceGroupName = "resourceGroup";
78-
string accountName = "automation";
79-
string runbookName = "runbook";
80-
string type = "GraphicalPowerShell";
81-
82-
this.mockAutomationClient.Setup(
83-
f => f.CreateRunbookByName(resourceGroupName, accountName, runbookName, null, null, RunbookTypeEnum.GraphPowerShell, null, null, false));
84-
85-
this.cmdlet.ResourceGroupName = resourceGroupName;
86-
this.cmdlet.AutomationAccountName = accountName;
87-
this.cmdlet.Name = runbookName;
88-
this.cmdlet.Type = type;
89-
this.cmdlet.SetParameterSet("ByRunbookName");
90-
this.cmdlet.ExecuteCmdlet();
91-
92-
this.mockAutomationClient.Verify(f => f.CreateRunbookByName(resourceGroupName, accountName, runbookName, null, null, RunbookTypeEnum.GraphPowerShell, null, null, false), Times.Once());
93-
}
94-
95-
[TestMethod]
96-
public void NewAzureAutomationRunbookTypeValueSameAsSdk()
97-
{
98-
string resourceGroupName = "resourceGroup";
99-
string accountName = "automation";
100-
string runbookName = "runbook";
101-
string type = "PowerShellWorkflow";
102-
103-
this.mockAutomationClient.Setup(
104-
f => f.CreateRunbookByName(resourceGroupName, accountName, runbookName, null, null, RunbookTypeEnum.PowerShellWorkflow, null, null, false));
105-
106-
this.cmdlet.ResourceGroupName = resourceGroupName;
107-
this.cmdlet.AutomationAccountName = accountName;
108-
this.cmdlet.Name = runbookName;
109-
this.cmdlet.Type = type;
110-
this.cmdlet.SetParameterSet("ByRunbookName");
111-
this.cmdlet.ExecuteCmdlet();
112-
113-
this.mockAutomationClient.Verify(f => f.CreateRunbookByName(resourceGroupName, accountName, runbookName, null, null, RunbookTypeEnum.PowerShellWorkflow, null, null, false), Times.Once());
114-
}
11572
}
11673
}

src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationSchedule.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using System.Security.Permissions;
2020
using Microsoft.Azure.Commands.Automation.Common;
2121
using Microsoft.Azure.Commands.Automation.Model;
22+
using Microsoft.Azure.Commands.Automation.Properties;
2223
using DayOfWeek = Microsoft.Azure.Commands.Automation.Model.DayOfWeek;
2324

2425
namespace Microsoft.Azure.Commands.Automation.Cmdlet
@@ -192,7 +193,7 @@ private Schedule CreateMonthlyScheduleModel()
192193
var dayOfWeek = this.DayOfWeek.HasValue ? this.DayOfWeek.ToString() : null;
193194
if ((!string.IsNullOrWhiteSpace(dayOfWeek) && this.DayOfWeekOccurrence == 0) || (string.IsNullOrWhiteSpace(dayOfWeek) && this.DayOfWeekOccurrence != 0))
194195
{
195-
throw new Exception("for monthly occurrence, both day of week and occurrence need to be specified");
196+
throw new ArgumentException(Resources.MonthlyScheduleNeedsDayOfWeekAndOccurrence);
196197
}
197198

198199
var newSchedule = new Schedule

src/ResourceManager/Automation/Commands.Automation/Common/RunbookTypeSdkValue.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ public static string Resolve(string commandValue)
2929
{
3030
return RunbookTypeEnum.GraphPowerShellWorkflow;
3131
}
32-
else
33-
{
34-
return commandValue;
35-
}
32+
33+
return commandValue;
3634
}
3735
}
3836
}

src/ResourceManager/Automation/Commands.Automation/Properties/Resources.Designer.cs

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/Automation/Commands.Automation/Properties/Resources.resx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,4 +439,8 @@
439439
<data name="JobTerminalState" xml:space="preserve">
440440
<value>"Job terminal state : Id {0}, state {1}, time {2}"</value>
441441
</data>
442+
<data name="MonthlyScheduleNeedsDayOfWeekAndOccurrence" xml:space="preserve">
443+
<value>For monthly occurrence, both day of week and occurrence need to be specified.</value>
444+
<comment>Automation</comment>
445+
</data>
442446
</root>

0 commit comments

Comments
 (0)