Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public void CanCreateUpdateDeleteRunbook()
testFixture.UpdateRunbookContent(runbookName, runbookContentV2);

var updatedContent = testFixture.GetRunbookContent(runbookName);
var reader = new StreamReader(updatedContent);
Assert.Equal(runbookContentV2, reader.ReadToEnd());
Assert.Equal(runbookContentV2, updatedContent);

testFixture.DeleteRunbook(runbookName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ protected void CreateAutomationClient(MockContext context)
{
var handler = new RecordedDelegatingHandler();
this.automationClient = context.GetServiceClient<AutomationClient>(false, handler);
this.automationClient.ResourceGroupName = ResourceGroupName;
this.automationClient.AutomationAccountName = AutomationAccountName;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void CanGetMachineRunById()
{
this.CreateAutomationClient(context);

var run = this.automationClient.SoftwareUpdateConfigurationMachineRuns.GetById(runId);
var run = this.automationClient.SoftwareUpdateConfigurationMachineRuns.GetById(ResourceGroupName, AutomationAccountName, runId);
Assert.NotNull(run);
Assert.Equal(runId.ToString(), run.Name);
}
Expand All @@ -30,7 +30,7 @@ public void CanGetAllMachineRuns()
{
this.CreateAutomationClient(context);

var runs = this.automationClient.SoftwareUpdateConfigurationMachineRuns.List();
var runs = this.automationClient.SoftwareUpdateConfigurationMachineRuns.List(ResourceGroupName, AutomationAccountName);
Assert.NotNull(runs.Value);
Assert.Equal(27, runs.Value.Count);
}
Expand All @@ -44,7 +44,7 @@ public void CanGetAllRunsByCorrelationId()
{
this.CreateAutomationClient(context);

var runs = this.automationClient.SoftwareUpdateConfigurationMachineRuns.ListByCorrelationId(correlationId);
var runs = this.automationClient.SoftwareUpdateConfigurationMachineRuns.ListByCorrelationId(ResourceGroupName, AutomationAccountName, correlationId);
Assert.NotNull(runs.Value);
Assert.Equal(2, runs.Value.Count);
}
Expand All @@ -58,7 +58,7 @@ public void CanGetAllRunsByStatus()
{
this.CreateAutomationClient(context);

var runs = this.automationClient.SoftwareUpdateConfigurationMachineRuns.ListByStatus(status);
var runs = this.automationClient.SoftwareUpdateConfigurationMachineRuns.ListByStatus(ResourceGroupName, AutomationAccountName, status);
Assert.NotNull(runs.Value);
Assert.Equal(4, runs.Value.Count);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void CanGetRunById()
{
this.CreateAutomationClient(context);

var run = this.automationClient.SoftwareUpdateConfigurationRuns.GetById(runId);
var run = this.automationClient.SoftwareUpdateConfigurationRuns.GetById(ResourceGroupName, AutomationAccountName, runId);
Assert.NotNull(run);
Assert.Equal(runId.ToString(), run.Name);
}
Expand All @@ -30,7 +30,7 @@ public void CanGetAllRuns()
{
this.CreateAutomationClient(context);

var runs = this.automationClient.SoftwareUpdateConfigurationRuns.List();
var runs = this.automationClient.SoftwareUpdateConfigurationRuns.List(ResourceGroupName, AutomationAccountName);
Assert.NotNull(runs.Value);
Assert.Equal(15, runs.Value.Count);
}
Expand All @@ -44,7 +44,7 @@ public void CanGetAllRunsByConfigurationName()
{
this.CreateAutomationClient(context);

var runs = this.automationClient.SoftwareUpdateConfigurationRuns.ListByConfigurationName(configName);
var runs = this.automationClient.SoftwareUpdateConfigurationRuns.ListByConfigurationName(ResourceGroupName, AutomationAccountName, configName);
Assert.NotNull(runs.Value);
Assert.Equal(6, runs.Value.Count);
}
Expand All @@ -58,7 +58,7 @@ public void CanGetAllRunsByOs()
{
this.CreateAutomationClient(context);

var runs = this.automationClient.SoftwareUpdateConfigurationRuns.ListByOsType(os);
var runs = this.automationClient.SoftwareUpdateConfigurationRuns.ListByOsType(ResourceGroupName, AutomationAccountName, os);
Assert.NotNull(runs.Value);
Assert.Equal(17, runs.Value.Count);
}
Expand All @@ -72,7 +72,7 @@ public void CanGetAllRunsByStatus()
{
this.CreateAutomationClient(context);

var runs = this.automationClient.SoftwareUpdateConfigurationRuns.ListByStatus(status);
var runs = this.automationClient.SoftwareUpdateConfigurationRuns.ListByStatus(ResourceGroupName, AutomationAccountName, status);
Assert.NotNull(runs.Value);
Assert.Equal(2, runs.Value.Count);
}
Expand All @@ -86,7 +86,7 @@ public void CanGetAllRunsByStartTime()
{
this.CreateAutomationClient(context);

var runs = this.automationClient.SoftwareUpdateConfigurationRuns.ListByStartTime(startTime);
var runs = this.automationClient.SoftwareUpdateConfigurationRuns.ListByStartTime(ResourceGroupName, AutomationAccountName, startTime);
Assert.NotNull(runs.Value);
Assert.Equal(3, runs.Value.Count);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,41 +20,41 @@ public void CanCreateGetAndDelete()

// Create and get the first SUC (targeting 1 VMs)
var sucProperties = this.CreateSoftwareUpdateConfigurationModel(new[] { VM_01 });
var createResult = this.automationClient.SoftwareUpdateConfigurations.Create(updateConfigurationName_01, sucProperties);
var createResult = this.automationClient.SoftwareUpdateConfigurations.Create(ResourceGroupName, AutomationAccountName, updateConfigurationName_01, sucProperties);
Assert.NotNull(createResult);

var getResult = this.automationClient.SoftwareUpdateConfigurations.GetByName(updateConfigurationName_01);
var getResult = this.automationClient.SoftwareUpdateConfigurations.GetByName(ResourceGroupName, AutomationAccountName, updateConfigurationName_01);
Assert.NotNull(getResult);

// Create and get the second SUC (targeting 2 VMs)
sucProperties = this.CreateSoftwareUpdateConfigurationModel(new[] { VM_01, VM_02});
createResult = this.automationClient.SoftwareUpdateConfigurations.Create(updateConfigurationName_02, sucProperties);
createResult = this.automationClient.SoftwareUpdateConfigurations.Create(ResourceGroupName, AutomationAccountName, updateConfigurationName_02, sucProperties);
Assert.NotNull(createResult);

getResult = this.automationClient.SoftwareUpdateConfigurations.GetByName(updateConfigurationName_02);
getResult = this.automationClient.SoftwareUpdateConfigurations.GetByName(ResourceGroupName, AutomationAccountName, updateConfigurationName_02);
Assert.NotNull(getResult);

// List all SUCs
var listResult = this.automationClient.SoftwareUpdateConfigurations.List();
var listResult = this.automationClient.SoftwareUpdateConfigurations.List(ResourceGroupName, AutomationAccountName);
Assert.NotNull(listResult);
Assert.NotNull(listResult.Value);
Assert.Equal(9, listResult.Value.Count);

// List for specific VM
listResult = this.automationClient.SoftwareUpdateConfigurations.ListByAzureVirtualMachine(VM_01);
listResult = this.automationClient.SoftwareUpdateConfigurations.ListByAzureVirtualMachine(ResourceGroupName, AutomationAccountName, VM_01);
Assert.NotNull(listResult);
Assert.NotNull(listResult.Value);
Assert.Equal(6, listResult.Value.Count);
var suc = listResult.Value.Where(v => v.Name.Equals(updateConfigurationName_01, StringComparison.OrdinalIgnoreCase)).Single();
Assert.Equal(updateConfigurationName_01, suc.Name);

// Delete both
this.automationClient.SoftwareUpdateConfigurations.Delete(updateConfigurationName_01);
getResult = this.automationClient.SoftwareUpdateConfigurations.GetByName(updateConfigurationName_01);
this.automationClient.SoftwareUpdateConfigurations.Delete(ResourceGroupName, AutomationAccountName, updateConfigurationName_01);
getResult = this.automationClient.SoftwareUpdateConfigurations.GetByName(ResourceGroupName, AutomationAccountName, updateConfigurationName_01);
Assert.Null(getResult);

this.automationClient.SoftwareUpdateConfigurations.Delete(updateConfigurationName_02);
getResult = this.automationClient.SoftwareUpdateConfigurations.GetByName(updateConfigurationName_02);
this.automationClient.SoftwareUpdateConfigurations.Delete(ResourceGroupName, AutomationAccountName, updateConfigurationName_02);
getResult = this.automationClient.SoftwareUpdateConfigurations.GetByName(ResourceGroupName, AutomationAccountName, updateConfigurationName_02);
Assert.Null(getResult);
}
}
Expand Down
Loading