-
Notifications
You must be signed in to change notification settings - Fork 34
/
PerfDataUnitTest.cs
39 lines (33 loc) · 1.49 KB
/
PerfDataUnitTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.Performance.Toolkit.Engine;
using Microsoft.Performance.Toolkit.Plugins.PerfDataExtension;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
using Assembly = System.Reflection.Assembly;
namespace PerfDataUnitTest
{
[TestClass]
public class PerfDataUnitTest
{
[TestMethod]
public void ProcessPerfGenericEvents()
{
// Input data
var inputPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var perfDataPath = Path.Combine(inputPath, "TestData\\perf.data");
Assert.IsTrue(File.Exists(perfDataPath));
var pluginPath = Path.GetDirectoryName(typeof(PerfDataProcessingSource).Assembly.Location);
using var plugins = PluginSet.Load(pluginPath);
using var dataSources = DataSourceSet.Create(plugins);
dataSources.AddFile(perfDataPath);
var createInfo = new EngineCreateInfo(dataSources.AsReadOnly());
using var engine = Engine.Create(createInfo);
engine.EnableCooker(PerfDataGenericSourceCooker.DataCookerPath);
engine.EnableTable(PerfDataGenericEventsTable.TableDescriptor);
var results = engine.Process();
var table = results.BuildTable(PerfDataGenericEventsTable.TableDescriptor);
Assert.AreEqual(1003, table.RowCount);
}
}
}