-
Notifications
You must be signed in to change notification settings - Fork 335
/
Copy pathTestLoggerExtensionManager.cs
102 lines (91 loc) · 3.19 KB
/
TestLoggerExtensionManager.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#nullable disable
namespace Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework;
using System.Collections.Generic;
using Utilities;
using Interfaces;
using ObjectModel.Client;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
/// <summary>
/// Manages loading and provides access to logging extensions implementing the
/// ITestLogger interface.
/// </summary>
internal class TestLoggerExtensionManager : TestExtensionManager<ITestLogger, ITestLoggerCapabilities>
{
/// <summary>
/// Initializes a new instance of the <see cref="TestLoggerExtensionManager"/> class.
/// </summary>
/// <param name="unfilteredTestExtensions">
/// The unfiltered Test Extensions.
/// </param>
/// <param name="testExtensions">
/// The test Extensions.
/// </param>
/// <param name="logger">
/// The logger.
/// </param>
/// <remarks>
/// The constructor is not public because the factory method should be used to get instances of this class.
/// </remarks>
protected TestLoggerExtensionManager(
IEnumerable<LazyExtension<ITestLogger, Dictionary<string, object>>> unfilteredTestExtensions,
IEnumerable<LazyExtension<ITestLogger, ITestLoggerCapabilities>> testExtensions,
IMessageLogger logger)
: base(unfilteredTestExtensions, testExtensions, logger)
{
}
/// <summary>
/// Gets an instance of the TestLoggerExtensionManager.
/// </summary>
/// <param name="messageLogger">
/// The message Logger.
/// </param>
/// <returns>
/// The TestLoggerExtensionManager.
/// </returns>
public static TestLoggerExtensionManager Create(IMessageLogger messageLogger)
{
TestPluginManager.GetSpecificTestExtensions<TestLoggerPluginInformation, ITestLogger, ITestLoggerCapabilities, TestLoggerMetadata>(
TestPlatformConstants.TestLoggerEndsWithPattern,
out IEnumerable<LazyExtension<ITestLogger, Dictionary<string, object>>> unfilteredTestExtensions,
out IEnumerable<LazyExtension<ITestLogger, ITestLoggerCapabilities>> filteredTestExtensions);
return new TestLoggerExtensionManager(unfilteredTestExtensions, filteredTestExtensions, messageLogger);
}
}
/// <summary>
/// Hold data about the Test logger.
/// </summary>
public class TestLoggerMetadata : ITestLoggerCapabilities
{
/// <summary>
/// Constructor for TestLoggerMetadata
/// </summary>
/// <param name="extension">
/// Uri identifying the logger.
/// </param>
/// <param name="friendlyName">
/// The friendly Name.
/// </param>
public TestLoggerMetadata(string extension, string friendlyName)
{
ExtensionUri = extension;
FriendlyName = friendlyName;
}
/// <summary>
/// Gets Uri identifying the logger.
/// </summary>
public string ExtensionUri
{
get;
private set;
}
/// <summary>
/// Gets Friendly Name identifying the logger.
/// </summary>
public string FriendlyName
{
get;
private set;
}
}