// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.SqlServer.Management.XEvent; using Microsoft.SqlTools.Hosting.Protocol; using Microsoft.SqlTools.ServiceLayer.Connection; using Microsoft.SqlTools.ServiceLayer.Profiler; using Microsoft.SqlTools.ServiceLayer.Profiler.Contracts; using Microsoft.SqlTools.ServiceLayer.UnitTests.Utility; using Moq; using Xunit; namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Profiler { public static class ProfilerTestObjects { public static List TestProfilerEvents { get { return new List { new ProfilerEvent("event1", "1/1/2017"), new ProfilerEvent("event2", "1/2/2017"), new ProfilerEvent("event3", "1/3/2017") }; } } } public class TestSessionListener : IProfilerSessionListener { public string PreviousSessionId { get; set; } public List PreviousEvents { get; set; } public void EventsAvailable(string sessionId, List events) { this.PreviousSessionId = sessionId; this.PreviousEvents = events; } } public class TestXEventSession : IXEventSession { private string testXEventXml = "" + " " + " " + " " + " 51" + " " + " " + " " + " false" + " " + " " + " " + " 1" + " " + " " + " " + " 4096" + " " + " " + " " + " 0" + " " + " " + " " + " 2" + " " + " " + " " + " 191053000" + " " + " " + " " + " 4680" + " " + " " + " " + " 2000002838f4010000000000" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " 01" + " " + " " + " " + " " + " " + " " + " " + " 01" + " " + " " + " " + " 56" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " 930958063" + " " + " " + " " + " " + " " + " " + " " + " A2873402-C433-4D1F-94C4-9CA99749453E-0" + " " + " " + " " + " 770C3538-EC3F-4A27-86A9-31A2FC777DBC-1" + " " + " " + ""; public string GetTargetXml() { return testXEventXml; } } public class TestXEventSessionFactory : IXEventSessionFactory { public IXEventSession CreateXEventSession(ConnectionInfo connInfo) { return new TestXEventSession(); } } }