mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
* Initial non-refactored SQL Agent alert classes (WIP) * Move agent classes into subdirectories * Refactor the agent config code a bit more * Add more implementation for handlers * Add more code to the create alert handler * Clean up agent alert class * Clean up alert methods a bit * Initial Operator contracts * Additonal SQL Agent config changes * More Proxy config cleanup * Cleanup AgentProxy class * Additional cleanups * Run SRGen * Add security service to create credential objects
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
//
|
|
// Copyright (c) Microsoft. All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
//
|
|
|
|
using System.Threading.Tasks;
|
|
using Microsoft.SqlTools.Hosting.Protocol;
|
|
using Microsoft.SqlTools.ServiceLayer.Agent;
|
|
using Microsoft.SqlTools.ServiceLayer.Agent.Contracts;
|
|
using Moq;
|
|
|
|
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
|
{
|
|
public static class AgentTestUtils
|
|
{
|
|
internal static async Task<AgentAlertInfo[]> GetAgentAlerts(string connectionUri)
|
|
{
|
|
var requestParams = new AgentAlertsParams()
|
|
{
|
|
OwnerUri = connectionUri
|
|
};
|
|
|
|
var requestContext = new Mock<RequestContext<AgentAlertsResult>>();
|
|
|
|
AgentAlertInfo[] agentAlerts = null;
|
|
requestContext.Setup(x => x.SendResult(It.IsAny<AgentAlertsResult>()))
|
|
.Callback<AgentAlertsResult>(r => agentAlerts = r.Alerts);
|
|
|
|
AgentService service = new AgentService();
|
|
await service.HandleAgentAlertsRequest(requestParams, requestContext.Object);
|
|
return agentAlerts;
|
|
}
|
|
}
|
|
}
|