Skip to content

Commit ce104cb

Browse files
committed
Refactor WeekDays enum values and update related tests for clarity
1 parent 8477aa4 commit ce104cb

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

tests/Unit/Public/New-SqlDscAgentOperator.Tests.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ Describe 'New-SqlDscAgentOperator' -Tag 'Public' {
181181
}
182182
@{
183183
PropertyName = 'PagerDays'
184-
PropertyValue = [Microsoft.SqlServer.Management.Smo.Agent.WeekDays]::Weekdays
185-
Parameters = @{ PagerDays = [Microsoft.SqlServer.Management.Smo.Agent.WeekDays]::Weekdays }
184+
PropertyValue = 'Weekdays'
185+
Parameters = @{ PagerDays = 'Weekdays' }
186186
}
187187
@{
188188
PropertyName = 'SaturdayPagerEndTime'
@@ -252,7 +252,7 @@ Describe 'New-SqlDscAgentOperator' -Tag 'Public' {
252252
CategoryName = 'DatabaseAdmins'
253253
NetSendAddress = 'SQLSERVER01'
254254
PagerAddress = '555-999-8888'
255-
PagerDays = [Microsoft.SqlServer.Management.Smo.Agent.WeekDays]::AllDays
255+
PagerDays = 'EveryDay'
256256
SaturdayPagerStartTime = [System.TimeSpan]::new(8, 0, 0)
257257
SaturdayPagerEndTime = [System.TimeSpan]::new(18, 0, 0)
258258
SundayPagerStartTime = [System.TimeSpan]::new(9, 0, 0)
@@ -273,7 +273,7 @@ Describe 'New-SqlDscAgentOperator' -Tag 'Public' {
273273
$result.CategoryName | Should -Be 'DatabaseAdmins'
274274
$result.NetSendAddress | Should -Be 'SQLSERVER01'
275275
$result.PagerAddress | Should -Be '555-999-8888'
276-
$result.PagerDays | Should -Be ([Microsoft.SqlServer.Management.Smo.Agent.WeekDays]::AllDays)
276+
$result.PagerDays | Should -Be 'EveryDay'
277277
$result.SaturdayPagerStartTime | Should -Be ([System.TimeSpan]::new(8, 0, 0))
278278
$result.SaturdayPagerEndTime | Should -Be ([System.TimeSpan]::new(18, 0, 0))
279279
$result.SundayPagerStartTime | Should -Be ([System.TimeSpan]::new(9, 0, 0))

tests/Unit/Stubs/SMO.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,14 +1610,14 @@ public enum CompletionAction
16101610
// Set-SqlDscAgentOperator.Tests.ps1
16111611
public enum WeekDays
16121612
{
1613+
Sunday = 1,
16131614
Monday = 2,
16141615
Tuesday = 4,
16151616
Wednesday = 8,
16161617
Thursday = 16,
16171618
Friday = 32,
1618-
Saturday = 64,
1619-
Sunday = 1,
16201619
Weekdays = 62,
1620+
Saturday = 64,
16211621
WeekEnds = 65,
16221622
EveryDay = 127
16231623
}
@@ -1826,28 +1826,28 @@ public Operator(Microsoft.SqlServer.Management.Smo.Agent.JobServer jobServer, Sy
18261826
public Microsoft.SqlServer.Management.Smo.Agent.JobServer Parent { get; set; }
18271827

18281828
// Method
1829-
public void Create()
1830-
{
1829+
public void Create()
1830+
{
18311831
if (this.Parent != null)
18321832
{
18331833
this.Parent.MockOperatorMethodCreateCalled++;
18341834
}
1835-
1835+
18361836
// Mock failure for specific operator name used in testing
18371837
if (this.Name == "MockFailMethodCreateOperator")
18381838
{
18391839
throw new System.Exception("Simulated Create() method failure for testing purposes.");
18401840
}
18411841
}
1842-
public void Drop()
1843-
{
1842+
public void Drop()
1843+
{
18441844
if (this.Parent != null)
18451845
{
18461846
this.Parent.MockOperatorMethodDropCalled++;
18471847
}
18481848
}
1849-
public void Alter()
1850-
{
1849+
public void Alter()
1850+
{
18511851
if (this.Parent != null)
18521852
{
18531853
this.Parent.MockOperatorMethodAlterCalled++;

0 commit comments

Comments
 (0)