Bugs fixes so XEvent profiler isn't broken (#577)

* Fix a few issues with profiler method handlers

* Filter out profiler polling events

* Add a unit test for profiler events

* Add method comment headers
This commit is contained in:
Karl Burtram
2018-01-17 18:21:40 -08:00
committed by GitHub
parent 7b1a88f842
commit 0121531bf6
7 changed files with 110 additions and 12 deletions

View File

@@ -48,6 +48,30 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Profiler
Assert.Equal(newProfilerEvents.Count, 0);
}
/// <summary>
/// Test the FilterProfilerEvents method
/// </summary>
[Fact]
public void TestFilterProfilerEvents()
{
// create a profiler session and get some test events
var profilerSession = new ProfilerSession();
var profilerEvents = ProfilerTestObjects.TestProfilerEvents;
int expectedEventCount = profilerEvents.Count;
// add a new "Profiler Polling" event
var newEvent = new ProfilerEvent("sql_batch_completed", "1/1/2017");
newEvent.Values.Add("batch_text", "SELECT target_data FROM sys.dm_xe_session_targets");
profilerEvents.Add(newEvent);
// verify that the polling event is removed
Assert.Equal(profilerEvents.Count, expectedEventCount + 1);
var newProfilerEvents = profilerSession.FilterProfilerEvents(profilerEvents);
Assert.Equal(newProfilerEvents.Count, expectedEventCount);
}
/// <summary>
/// Test the TryEnterPolling method
/// </summary>