mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-23 01:25:42 -05:00
Porting showplan code from ssms (#1280)
* Porting showplan code from ssms * Moving showplans bits to a subfolder * code cleanup * Remvoing unnecssary conditional visibility
This commit is contained in:
@@ -29,4 +29,8 @@
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
<ItemGroup>
|
||||
<Content Remove=".\ShowPlan\TestExecution.xml" />
|
||||
<EmbeddedResource Include=".\ShowPlan\TestExecutionPlan.xml" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// 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.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using Microsoft.SqlTools.ServiceLayer.ShowPlan.ShowPlanGraph;
|
||||
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ShowPlan
|
||||
{
|
||||
public class ShowPlanXMLTests
|
||||
{
|
||||
[Test]
|
||||
public async Task ParseXMLFileReturnsValidShowPlanGraph()
|
||||
{
|
||||
Assembly assembly = Assembly.GetAssembly(typeof(ShowPlanXMLTests));
|
||||
Stream scriptStream = assembly.GetManifestResourceStream(assembly.GetName().Name + ".ShowPlan.TestExecutionPlan.xml");
|
||||
StreamReader reader = new StreamReader(scriptStream);
|
||||
string text = reader.ReadToEnd();
|
||||
var showPlanGraphs = ShowPlanGraph.ParseShowPlanXML(text, ShowPlanType.Actual);
|
||||
Assert.AreEqual(1, showPlanGraphs.Length, "Single show plan graph not generated from the test xml file");
|
||||
var testShowPlanGraph = showPlanGraphs[0];
|
||||
Assert.NotNull(testShowPlanGraph, "graph should not be null");
|
||||
Assert.NotNull(testShowPlanGraph.Root, "graph should have a root");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user