Skip to content
Merged
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 @@ -12,45 +12,36 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Xunit;
using Microsoft.Azure.ServiceManagement.Common.Models;
using Xunit.Abstractions;

namespace Microsoft.Azure.Commands.AlertsManagement.Test.ScenarioTests
{
public class AlertPRuleTests : RMTestBase
public class AlertPRuleTests : AlertsManagementTestRunner
{
public XunitTracingInterceptor _logger;

public AlertPRuleTests(Xunit.Abstractions.ITestOutputHelper output)
public AlertPRuleTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new XunitTracingInterceptor(output);
XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAlertProcessingRulesByResourceGroupName()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-GetAlertProcessingRulesByResourceGroupName");
TestRunner.RunTestScript("Test-GetAlertProcessingRulesByResourceGroupName");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateUpdateAndDeleteSuppressionRule()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CreateUpdateAndDeleteSuppressionRule");
TestRunner.RunTestScript("Test-CreateUpdateAndDeleteSuppressionRule");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateUpdateAndDeleteActionGroupRule()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CreateUpdateAndDeleteActionGroupRule");
TestRunner.RunTestScript("Test-CreateUpdateAndDeleteActionGroupRule");
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,36 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Xunit;
using Microsoft.Azure.ServiceManagement.Common.Models;

namespace Microsoft.Azure.Commands.AlertsManagement.Test.ScenarioTests
{
public class AlertTests : RMTestBase
public class AlertTests : AlertsManagementTestRunner
{
public XunitTracingInterceptor _logger;

public AlertTests(Xunit.Abstractions.ITestOutputHelper output)
public AlertTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new XunitTracingInterceptor(output);
XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAlertChangeState()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-AlertChangeState");
TestRunner.RunTestScript("Test-AlertChangeState");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAlertsFilteredByParameters()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-GetAlertsFilteredByParameters");
TestRunner.RunTestScript("Test-GetAlertsFilteredByParameters");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAlertsSummary()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-AlertsSummary");
TestRunner.RunTestScript("Test-AlertsSummary");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using System.Collections.Generic;
using Microsoft.Azure.Commands.TestFx;
using Xunit.Abstractions;

namespace Microsoft.Azure.Commands.AlertsManagement.Test.ScenarioTests
{
public class AlertsManagementTestRunner
{
protected readonly ITestRunner TestRunner;

protected AlertsManagementTestRunner(ITestOutputHelper output)
{
TestRunner = TestManager.CreateInstance(output)
.WithNewPsScriptFilename($"{GetType().Name}.ps1")
.WithProjectSubfolderForTests("ScenarioTests")
.WithCommonPsScripts(new[]
{
@"Common.ps1",
@"../AzureRM.Resources.ps1",
})
.WithNewRmModules(helper => new[]
{
helper.RMProfileModule,
helper.GetRMModulePath("Az.AlertsManagement.psd1")
})
.WithNewRecordMatcherArguments(
userAgentsToIgnore: new Dictionary<string, string>
{
{"Microsoft.Azure.Management.Resources.ResourceManagementClient", "2016-02-01"},
},
resourceProviders: new Dictionary<string, string>
{
{"Microsoft.AlertsManagement", null}
}
)
.Build();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,22 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Xunit;
using Microsoft.Azure.ServiceManagement.Common.Models;

namespace Microsoft.Azure.Commands.AlertsManagement.Test.ScenarioTests
{
public class SmartGroupTests : RMTestBase
public class SmartGroupTests : AlertsManagementTestRunner
{
public XunitTracingInterceptor _logger;

public SmartGroupTests(Xunit.Abstractions.ITestOutputHelper output)
public SmartGroupTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new XunitTracingInterceptor(output);
XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSmartGroupChangeState()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-SmartGroupChangeState");
TestRunner.RunTestScript("Test-SmartGroupChangeState");
}
}
}

This file was deleted.