-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
LoggingServiceFactory_Tests.cs
40 lines (36 loc) · 1.57 KB
/
LoggingServiceFactory_Tests.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
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Build.BackEnd.Logging;
using Microsoft.Build.BackEnd;
using Xunit;
#nullable disable
namespace Microsoft.Build.UnitTests.Logging
{
/// <summary>
/// Test the Factory to create components of the type LoggingService
/// </summary>
public class LoggingServiceFactory_Tests
{
/// <summary>
/// Verify we can create a synchronous LoggingService
/// </summary>
[Fact]
public void TestCreateSynchronousLogger()
{
LoggingServiceFactory factory = new LoggingServiceFactory(LoggerMode.Synchronous, 1);
LoggingService loggingService = (LoggingService)factory.CreateInstance(BuildComponentType.LoggingService);
Assert.Equal(LoggerMode.Synchronous, loggingService.LoggingMode); // "Expected to create a Synchronous LoggingService"
}
/// <summary>
/// Verify we can create a Asynchronous LoggingService
/// </summary>
[Fact]
public void TestCreateAsynchronousLogger()
{
LoggingServiceFactory factory = new LoggingServiceFactory(LoggerMode.Asynchronous, 1);
LoggingService loggingService = (LoggingService)factory.CreateInstance(BuildComponentType.LoggingService);
Assert.Equal(LoggerMode.Asynchronous, loggingService.LoggingMode); // "Expected to create an Asynchronous LoggingService"
loggingService.ShutdownComponent();
}
}
}