Skip to content

Commit 09d4f74

Browse files
committed
[Insights] Including PR feedback before Ignite #1
1 parent bc68f11 commit 09d4f74

File tree

50 files changed

+339
-150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+339
-150
lines changed

src/ResourceManager/Insights/Commands.Insights.Test/ActivityLogAlerts/DisableAzureRmActivityLogAlertTests.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public class DisableAzureRmActivityLogAlertTests
4040

4141
public DisableAzureRmActivityLogAlertTests(Xunit.Abstractions.ITestOutputHelper output)
4242
{
43+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
4344
TestExecutionHelpers.SetUpSessionAndProfile();
44-
//ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
4545
insightsOperationsMock = new Mock<IActivityLogAlertsOperations>();
4646
monitorClientMock = new Mock<MonitorManagementClient>();
4747
commandRuntimeMock = new Mock<ICommandRuntime>();
@@ -96,7 +96,7 @@ public void DisableActivityLogAlertCommandParametersProcessing()
9696
Assert.False(this.body.Enabled);
9797
Assert.Null(this.body.Tags);
9898

99-
ActivityLogAlertResource resource = new ActivityLogAlertResource(location: "Global", scopes: null, condition: null, name: "alert1", actions: null, id: "//subscriptions/32323/resourcegroups/" + Utilities.ResourceGroup)
99+
ActivityLogAlertResource resource = new ActivityLogAlertResource(location: "Global", scopes: null, condition: null, name: "andy0307rule", actions: null, id: "//subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Default-ActivityLogAlerts/providers/microsoft.insights/activityLogAlerts/andy0307rule")
100100
{
101101
Enabled = true
102102
};
@@ -105,8 +105,17 @@ public void DisableActivityLogAlertCommandParametersProcessing()
105105
cmdlet.ExecuteCmdlet();
106106

107107
Assert.NotNull(this.body);
108-
Assert.Equal(Utilities.ResourceGroup, this.resourceGroup);
109-
Assert.Equal("alert1", this.name);
108+
Assert.Equal("Default-ActivityLogAlerts", this.resourceGroup);
109+
Assert.Equal("andy0307rule", this.name);
110+
Assert.False(this.body.Enabled);
111+
Assert.Null(this.body.Tags);
112+
113+
cmdlet.InputObject = null;
114+
cmdlet.ResourceId = "/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Default-ActivityLogAlerts/providers/microsoft.insights/activityLogAlerts/andy0307rule";
115+
cmdlet.ExecuteCmdlet();
116+
Assert.NotNull(this.body);
117+
Assert.Equal("Default-ActivityLogAlerts", this.resourceGroup);
118+
Assert.Equal("andy0307rule", this.name);
110119
Assert.False(this.body.Enabled);
111120
Assert.Null(this.body.Tags);
112121
}

src/ResourceManager/Insights/Commands.Insights.Test/ActivityLogAlerts/EnableAzureRmActivityLogAlertTests.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public class EnableAzureRmActivityLogAlertTests
4040

4141
public EnableAzureRmActivityLogAlertTests(Xunit.Abstractions.ITestOutputHelper output)
4242
{
43+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
4344
TestExecutionHelpers.SetUpSessionAndProfile();
44-
//ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
4545
insightsOperationsMock = new Mock<IActivityLogAlertsOperations>();
4646
monitorClientMock = new Mock<MonitorManagementClient>();
4747
commandRuntimeMock = new Mock<ICommandRuntime>();
@@ -96,7 +96,7 @@ public void EnableActivityLogAlertCommandParametersProcessing()
9696
Assert.True(this.body.Enabled);
9797
Assert.Null(this.body.Tags);
9898

99-
ActivityLogAlertResource resource = new ActivityLogAlertResource(location: "Global", scopes: null, condition: null, name: "alert1", actions: null, id: "//subscriptions/32323/resourcegroups/" + Utilities.ResourceGroup)
99+
ActivityLogAlertResource resource = new ActivityLogAlertResource(location: "Global", scopes: null, condition: null, name: "andy0307rule", actions: null, id: "//subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Default-ActivityLogAlerts/providers/microsoft.insights/activityLogAlerts/andy0307rule")
100100
{
101101
Enabled = false
102102
};
@@ -105,8 +105,17 @@ public void EnableActivityLogAlertCommandParametersProcessing()
105105
cmdlet.ExecuteCmdlet();
106106

107107
Assert.NotNull(this.body);
108-
Assert.Equal(Utilities.ResourceGroup, this.resourceGroup);
109-
Assert.Equal("alert1", this.name);
108+
Assert.Equal("Default-ActivityLogAlerts", this.resourceGroup);
109+
Assert.Equal("andy0307rule", this.name);
110+
Assert.True(this.body.Enabled);
111+
Assert.Null(this.body.Tags);
112+
113+
cmdlet.InputObject = null;
114+
cmdlet.ResourceId = "/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Default-ActivityLogAlerts/providers/microsoft.insights/activityLogAlerts/andy0307rule";
115+
cmdlet.ExecuteCmdlet();
116+
Assert.NotNull(this.body);
117+
Assert.Equal("Default-ActivityLogAlerts", this.resourceGroup);
118+
Assert.Equal("andy0307rule", this.name);
110119
Assert.True(this.body.Enabled);
111120
Assert.Null(this.body.Tags);
112121
}

src/ResourceManager/Insights/Commands.Insights.Test/ActivityLogAlerts/GetAzureRmActivityLogAlertTests.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public class GetAzureRmActivityLogAlertTests
4040

4141
public GetAzureRmActivityLogAlertTests(Xunit.Abstractions.ITestOutputHelper output)
4242
{
43+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
4344
TestExecutionHelpers.SetUpSessionAndProfile();
44-
//ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
4545
insightsOperationsMock = new Mock<IActivityLogAlertsOperations>();
4646
insightsManagementClientMock = new Mock<MonitorManagementClient>();
4747
commandRuntimeMock = new Mock<ICommandRuntime>();
@@ -106,11 +106,6 @@ public void GetAutoscaleSettingCommandParametersProcessing()
106106

107107
Assert.Equal(Utilities.ResourceGroup, this.resourceGroup);
108108
Assert.Equal(Utilities.Name, this.name);
109-
110-
// Error
111-
cmdlet.ResourceGroupName = " ";
112-
cmdlet.Name = Utilities.Name;
113-
Assert.Throws<PSArgumentException>(() => cmdlet.ExecuteCmdlet());
114109
}
115110
}
116111
}

src/ResourceManager/Insights/Commands.Insights.Test/ActivityLogAlerts/NewAzureRmActionGroupTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class NewAzureRmActionGroupTests
2828

2929
public NewAzureRmActionGroupTests(Xunit.Abstractions.ITestOutputHelper output)
3030
{
31-
//ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
31+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
3232
commandRuntimeMock = new Mock<ICommandRuntime>();
3333
Cmdlet = new NewAzureRmActionGroupCommand()
3434
{

src/ResourceManager/Insights/Commands.Insights.Test/ActivityLogAlerts/NewAzureRmActivityLogAlertConditionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class NewAzureRmActivityLogAlertConditionTests
2828

2929
public NewAzureRmActivityLogAlertConditionTests(Xunit.Abstractions.ITestOutputHelper output)
3030
{
31-
//ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
31+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
3232
commandRuntimeMock = new Mock<ICommandRuntime>();
3333
Cmdlet = new NewAzureRmActivityLogAlertConditionCommand()
3434
{

src/ResourceManager/Insights/Commands.Insights.Test/ActivityLogAlerts/RemoveAzureRmActivityLogAlertTests.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public class RemoveAzureRmActivityLogAlertTests
3838

3939
public RemoveAzureRmActivityLogAlertTests(Xunit.Abstractions.ITestOutputHelper output)
4040
{
41+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
4142
TestExecutionHelpers.SetUpSessionAndProfile();
42-
//ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
4343
insightsOperationsMock = new Mock<IActivityLogAlertsOperations>();
4444
monitorClientMock = new Mock<MonitorManagementClient>();
4545
commandRuntimeMock = new Mock<ICommandRuntime>();
@@ -79,27 +79,34 @@ public void RemoveActivityLogAlertCommandParametersProcessing()
7979

8080
cmdlet.Name = null;
8181
cmdlet.ResourceGroupName = null;
82-
var resource = new ActivityLogAlertResource(location: "Global", scopes: null, condition: null, name: "alert1", actions: null, id: "subscriptions/32323/resourcegroups/Default-Web-EastUS")
82+
var resource = new ActivityLogAlertResource(location: "Global", scopes: null, condition: null, name: "andy0307rule", actions: null, id: "subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Default-ActivityLogAlerts/providers/microsoft.insights/activityLogAlerts/andy0307rule")
8383
{
8484
Enabled = false
8585
};
8686

8787
cmdlet.InputObject = new OutputClasses.PSActivityLogAlertResource(resource);
8888
cmdlet.ExecuteCmdlet();
8989

90-
Assert.Equal(Utilities.ResourceGroup, this.resourceGroup);
91-
Assert.Equal("alert1", this.name);
90+
Assert.Equal("Default-ActivityLogAlerts", this.resourceGroup);
91+
Assert.Equal("andy0307rule", this.name);
9292

93-
resource = new ActivityLogAlertResource(location: "Global", scopes: null, condition: null, name: "alert1", actions: null, id: "//subscriptions/32323/resourcegroups/Default-Web-EastUS/")
93+
resource = new ActivityLogAlertResource(location: "Global", scopes: null, condition: null, name: "andy0307rule", actions: null, id: "//subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Default-ActivityLogAlerts/providers/microsoft.insights/activityLogAlerts/andy0307rule")
9494
{
9595
Enabled = false
9696
};
9797

9898
cmdlet.InputObject = new OutputClasses.PSActivityLogAlertResource(resource);
9999
cmdlet.ExecuteCmdlet();
100100

101-
Assert.Equal(Utilities.ResourceGroup, this.resourceGroup);
102-
Assert.Equal("alert1", this.name);
101+
Assert.Equal("Default-ActivityLogAlerts", this.resourceGroup);
102+
Assert.Equal("andy0307rule", this.name);
103+
104+
cmdlet.InputObject = null;
105+
cmdlet.ResourceId = "/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Default-ActivityLogAlerts/providers/microsoft.insights/activityLogAlerts/andy0307rule";
106+
cmdlet.ExecuteCmdlet();
107+
108+
Assert.Equal("Default-ActivityLogAlerts", this.resourceGroup);
109+
Assert.Equal("andy0307rule", this.name);
103110
}
104111
}
105112
}

src/ResourceManager/Insights/Commands.Insights.Test/ActivityLogAlerts/SetAzureRmActivityLogAlertTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public class SetAzureRmActivityLogAlertTests
4141

4242
public SetAzureRmActivityLogAlertTests(Xunit.Abstractions.ITestOutputHelper output)
4343
{
44+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
4445
TestExecutionHelpers.SetUpSessionAndProfile();
45-
//ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
4646
insightsOperationsMock = new Mock<IActivityLogAlertsOperations>();
4747
insightsManagementClientMock = new Mock<MonitorManagementClient>();
4848
commandRuntimeMock = new Mock<ICommandRuntime>();

src/ResourceManager/Insights/Commands.Insights.Test/ActivityLogs/GetAzureRmLogTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class GetAzureRmLogTests
4242

4343
public GetAzureRmLogTests(Xunit.Abstractions.ITestOutputHelper output)
4444
{
45-
//ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
45+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
4646
insightsEventOperationsMock = new Mock<IActivityLogsOperations>();
4747
MonitorClientMock = new Mock<MonitorClient>();
4848
commandRuntimeMock = new Mock<ICommandRuntime>();

src/ResourceManager/Insights/Commands.Insights.Test/Alerts/AddAzureRmLogAlertRuleTests.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,14 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Commands.Common.Authentication;
1615
using Microsoft.Azure.Commands.Insights.Alerts;
17-
using Microsoft.Azure.Commands.ResourceManager.Common;
1816
using Microsoft.Azure.Commands.ScenarioTest;
1917
using Microsoft.Azure.Management.Monitor.Management;
2018
using Microsoft.Azure.Management.Monitor.Management.Models;
2119
using Microsoft.WindowsAzure.Commands.ScenarioTest;
2220
using Moq;
23-
using System;
2421
using System.Collections.Generic;
2522
using System.Management.Automation;
26-
using System.Net;
2723
using System.Threading;
2824
using System.Threading.Tasks;
2925
using Xunit;
@@ -43,8 +39,8 @@ public class AddAzureRmLogAlertRuleTests
4339

4440
public AddAzureRmLogAlertRuleTests(ITestOutputHelper output)
4541
{
42+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
4643
TestExecutionHelpers.SetUpSessionAndProfile();
47-
// XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
4844
insightsAlertRuleOperationsMock = new Mock<IAlertRulesOperations>();
4945
insightsManagementClientMock = new Mock<MonitorManagementClient>();
5046
commandRuntimeMock = new Mock<ICommandRuntime>();

src/ResourceManager/Insights/Commands.Insights.Test/Alerts/AddAzureRmMetricAlertRuleTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public class AddAzureRmMetricAlertRuleTests
4343

4444
public AddAzureRmMetricAlertRuleTests(ITestOutputHelper output)
4545
{
46+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
4647
TestExecutionHelpers.SetUpSessionAndProfile();
47-
//XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
4848
insightsAlertRuleOperationsMock = new Mock<IAlertRulesOperations>();
4949
insightsManagementClientMock = new Mock<MonitorManagementClient>();
5050
commandRuntimeMock = new Mock<ICommandRuntime>();

0 commit comments

Comments
 (0)