Skip to content

Commit

Permalink
Add SecurityInsightsTestRunner and replace TestController (#18228)
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainFanZzz authored May 18, 2022
1 parent 13fe2cf commit 635e5c3
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 235 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,57 +12,50 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

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

namespace Microsoft.Azure.Commands.SecurityInsights.Test.ScenarioTests
{
public class ActionsTests
public class ActionsTests : SecurityInsightsTestRunner
{
private readonly XunitTracingInterceptor _logger;

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

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

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void CreateAction()
{
TestController.NewInstance.RunPowerShellTest(_logger, "New-AzSentinelAlertRuleAction-Create");
TestRunner.RunTestScript("New-AzSentinelAlertRuleAction-Create");
}

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RemoveAction()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Remove-AzSentinelAlertRuleAction-Delete");
TestRunner.RunTestScript("Remove-AzSentinelAlertRuleAction-Delete");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,29 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

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

namespace Microsoft.Azure.Commands.SecurityInsights.Test.ScenarioTests
{
public class AlertRuleTemplatesTests
public class AlertRuleTemplatesTests : SecurityInsightsTestRunner
{
private readonly XunitTracingInterceptor _logger;

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

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void Get()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelAlertRuleTemplate-Get");
TestRunner.RunTestScript("Get-AzSentinelAlertRuleTemplate-Get");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,78 +12,71 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

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

namespace Microsoft.Azure.Commands.SecurityInsights.Test.ScenarioTests
{
public class AlertRulesTests
public class AlertRulesTests : SecurityInsightsTestRunner
{
private readonly XunitTracingInterceptor _logger;

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void ListAlertRules()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelAlertRule-List");
TestRunner.RunTestScript("Get-AzSentinelAlertRule-List");
}

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void CreateAlertRuleFusion()
{
TestController.NewInstance.RunPowerShellTest(_logger, "New-AzSentinelAlertRule-CreateFusion");
TestRunner.RunTestScript("New-AzSentinelAlertRule-CreateFusion");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void CreateAlertRuleMSIC()
{
TestController.NewInstance.RunPowerShellTest(_logger, "New-AzSentinelAlertRule-CreateMSIC");
TestRunner.RunTestScript("New-AzSentinelAlertRule-CreateMSIC");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void CreateAlertRuleScheduled()
{
TestController.NewInstance.RunPowerShellTest(_logger, "New-AzSentinelAlertRule-CreateScheduled");
TestRunner.RunTestScript("New-AzSentinelAlertRule-CreateScheduled");
}

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

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RemoveAlertRule()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Remove-AzSentinelAlertRule-Delete");
TestRunner.RunTestScript("Remove-AzSentinelAlertRule-Delete");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,64 +12,57 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

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

namespace Microsoft.Azure.Commands.SecurityInsights.Test.ScenarioTests
{
public class BookmarksTests
public class BookmarksTests : SecurityInsightsTestRunner
{
private readonly XunitTracingInterceptor _logger;

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

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

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

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

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

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void Remove()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Remove-AzSentinelBookmark-Remove");
TestRunner.RunTestScript("Remove-AzSentinelBookmark-Remove");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,64 +12,57 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

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

namespace Microsoft.Azure.Commands.SecurityInsights.Test.ScenarioTests
{
public class DataConnectorsTests
public class DataConnectorsTests : SecurityInsightsTestRunner
{
private readonly XunitTracingInterceptor _logger;

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

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

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

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

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

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void Delete()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Remove-AzSentinelDataConnector-Delete");
TestRunner.RunTestScript("Remove-AzSentinelDataConnector-Delete");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,36 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

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

namespace Microsoft.Azure.Commands.SecurityInsights.Test.ScenarioTests
{
public class IncidentCommentsTests
public class IncidentCommentsTests : SecurityInsightsTestRunner
{
private readonly XunitTracingInterceptor _logger;

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void List()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSentinelIncidentComment-ListByIncident");
TestRunner.RunTestScript("Get-AzSentinelIncidentComment-ListByIncident");
}

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void Create()
{
TestController.NewInstance.RunPowerShellTest(_logger, "New-AzSentinelIncidentComment-Create");
TestRunner.RunTestScript("New-AzSentinelIncidentComment-Create");
}
}
}
Loading

0 comments on commit 635e5c3

Please sign in to comment.